diff --git a/sentry-ruby/lib/sentry-ruby.rb b/sentry-ruby/lib/sentry-ruby.rb index 6dcf99671..4ebf5b299 100644 --- a/sentry-ruby/lib/sentry-ruby.rb +++ b/sentry-ruby/lib/sentry-ruby.rb @@ -50,6 +50,8 @@ module Sentry THREAD_LOCAL = :sentry_hub + MUTEX = Mutex.new + class << self # @!visibility private def exception_locals_tp @@ -275,8 +277,10 @@ def close @background_worker.shutdown - @main_hub = nil - Thread.current.thread_variable_set(THREAD_LOCAL, nil) + MUTEX.synchronize do + @main_hub = nil + Thread.current.thread_variable_set(THREAD_LOCAL, nil) + end end # Returns true if the SDK is initialized. @@ -303,7 +307,7 @@ def csp_report_uri # # @return [Hub] def get_main_hub - @main_hub + MUTEX.synchronize { @main_hub } end # Takes an instance of Sentry::Breadcrumb and stores it to the current active scope. diff --git a/sentry-sidekiq/Gemfile b/sentry-sidekiq/Gemfile index c158e85dc..c860cb206 100644 --- a/sentry-sidekiq/Gemfile +++ b/sentry-sidekiq/Gemfile @@ -12,9 +12,6 @@ gem "sentry-rails", path: "../sentry-rails" # loofah changed the required ruby version in a patch so we need to explicitly pin it gem "loofah", "2.20.0" if RUBY_VERSION.to_f < 2.5 -# For https://github.com/ruby/psych/issues/655 -gem "psych", "5.1.0" - sidekiq_version = ENV["SIDEKIQ_VERSION"] sidekiq_version = "7.0" if sidekiq_version.nil? sidekiq_version = Gem::Version.new(sidekiq_version)