Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while trying to deserialize arguments: uninitialized constant GlobalID::Locator #101

Closed
rafaelfranca opened this issue Apr 19, 2017 · 10 comments · Fixed by #102
Closed

Comments

@rafaelfranca
Copy link
Member

From @jwoertink on April 19, 2017 19:16

I don't get this error often, but sometimes I get

Error while trying to deserialize arguments: uninitialized constant GlobalID::Locator Did you mean? GlobalID::Locator

I'm not able to recreate this error locally, and out of 310 processed jobs, it's only shown up twice.

I'm using Sidekiq with ActiveJob on Rails 5.0.2 with ruby 2.4.1.

Here's the data from Sidekiq

Job
Queue 	default
Job 	{"job_class"=>"EncoderJob", "job_id"=>"2c6589f6-172e-4e83-9910-c4ffc29bb5d0", "queue_name"=>"default", "priority"=>nil, "arguments"=>["update", "poster", 54381, ["hq_gallery_zip_url", "promo_photo_pack_zip_url", "updated_at"]], "locale"=>"en"}
Arguments 	
JID 	6e64e144c2eea7c09d418b53
Enqueued 	2 days ago
Extras 	{"wrapped"=>"EncoderJob", "processor"=>"d14dcdc7631e:1"}
Error
Error Class 	ActiveJob::DeserializationError
Error Message 	Error while trying to deserialize arguments: uninitialized constant GlobalID::Locator Did you mean? GlobalID::Locator

Copied from original issue: rails/rails#28801

@Fredar
Copy link

Fredar commented May 4, 2017

I am seeing the same thing (only happened twice) with no obvious trigger.
ActiveJob 4.2.8 on 2.3.3 ruby with sidekiq 4.2.10 and globalID 0.4.0

It started few days after we bumped to rails 4.2.8 from 4.2.7.1, which also updated globalID from 0.3.7 to 0.4.0

@maia
Copy link

maia commented May 4, 2017

I've also seen this twice in the past weeks (with thousands of processed jobs), without a specific deploy I could pinpoint it to. The first time occurred shortly after upgrading from rails 4.2.8 to 5.0.

I'm running ruby 2.3.3, sidekiq 4.2.10, and globalid 0.4.0.

@phlegx
Copy link

phlegx commented May 10, 2017

I have the same problem!

  • Rails 4.2.8
  • ActiveJob 4.2.8
  • GlobalId 0.4.0
  • Sidekiq 4.2.9
  • Ruby 2.3.3

@fredngo
Copy link

fredngo commented Jun 8, 2017

I experienced the same with the following:

  • Rails 5.1.1
  • ActiveJob 5.1.1
  • GlobalId 0.4.0
  • Sidekiq 4.2.10
  • Ruby 2.4.1

@caiofct
Copy link

caiofct commented Jun 18, 2017

I'am experiencing the same error. It happens very much at random and only on production at Heroku. My stack:

  • Rails 5.1.1
  • ActiveJob 5.1.1
  • GlobalId 0.4.0
  • Sidekiq 5.0.0
  • Ruby 2.4.1

@marcgreenstock
Copy link

Same. I have the stacktrace if required. I'm using active-elastic-job instead of sidekiq.

@doits
Copy link

doits commented Jul 10, 2017

Just happened for me with sidekiq, here's the backtrace:

/2.4.0/gems/activejob-5.1.1/lib/active_job/arguments.rb:78:in `deserialize_argument'
/2.4.0/gems/activejob-5.1.1/lib/active_job/arguments.rb:39:in `block in deserialize'
/2.4.0/gems/activejob-5.1.1/lib/active_job/arguments.rb:39:in `map'
/2.4.0/gems/activejob-5.1.1/lib/active_job/arguments.rb:39:in `deserialize'
/2.4.0/gems/activejob-5.1.1/lib/active_job/core.rb:134:in `deserialize_arguments'
/2.4.0/gems/activejob-5.1.1/lib/active_job/core.rb:124:in `deserialize_arguments_if_needed'
/2.4.0/gems/activejob-5.1.1/lib/active_job/execution.rb:32:in `perform_now'
/2.4.0/gems/activejob-5.1.1/lib/active_job/execution.rb:22:in `block in execute'
/2.4.0/gems/activesupport-5.1.1/lib/active_support/callbacks.rb:108:in `block in run_callbacks'
/2.4.0/gems/activejob-5.1.1/lib/active_job/railtie.rb:26:in `block (4 levels) in <class:Railtie>'
/2.4.0/gems/activesupport-5.1.1/lib/active_support/execution_wrapper.rb:85:in `wrap'
/2.4.0/gems/activesupport-5.1.1/lib/active_support/reloader.rb:68:in `block in wrap'
/2.4.0/gems/activesupport-5.1.1/lib/active_support/execution_wrapper.rb:81:in `wrap'
/2.4.0/gems/activesupport-5.1.1/lib/active_support/reloader.rb:67:in `wrap'
/2.4.0/gems/activejob-5.1.1/lib/active_job/railtie.rb:25:in `block (3 levels) in <class:Railtie>'
/2.4.0/gems/activesupport-5.1.1/lib/active_support/callbacks.rb:117:in `instance_exec'
/2.4.0/gems/activesupport-5.1.1/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
/2.4.0/gems/activesupport-5.1.1/lib/active_support/callbacks.rb:135:in `run_callbacks'
/2.4.0/gems/activejob-5.1.1/lib/active_job/execution.rb:20:in `execute'
/2.4.0/gems/activejob-5.1.1/lib/active_job/queue_adapters/sidekiq_adapter.rb:40:in `perform'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:199:in `execute_job'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:170:in `block (2 levels) in process'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/middleware/chain.rb:128:in `block in invoke'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/middleware/chain.rb:133:in `invoke'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:169:in `block in process'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:141:in `block (6 levels) in dispatch'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/job_retry.rb:97:in `local'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:140:in `block (5 levels) in dispatch'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/rails.rb:42:in `block in call'
/2.4.0/gems/activesupport-5.1.1/lib/active_support/execution_wrapper.rb:85:in `wrap'
/2.4.0/gems/activesupport-5.1.1/lib/active_support/reloader.rb:68:in `block in wrap'
/2.4.0/gems/activesupport-5.1.1/lib/active_support/execution_wrapper.rb:85:in `wrap'
/2.4.0/gems/activesupport-5.1.1/lib/active_support/reloader.rb:67:in `wrap'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/rails.rb:41:in `call'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:136:in `block (4 levels) in dispatch'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:215:in `stats'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:131:in `block (3 levels) in dispatch'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/job_logger.rb:7:in `call'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:130:in `block (2 levels) in dispatch'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/job_retry.rb:72:in `global'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:129:in `block in dispatch'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/logging.rb:44:in `with_context'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/logging.rb:38:in `with_job_hash_context'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:128:in `dispatch'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:168:in `process'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:85:in `process_one'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:73:in `run'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/util.rb:16:in `watchdog'
/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/util.rb:25:in `block in safe_thread'

y-yagi added a commit to y-yagi/rails that referenced this issue Aug 12, 2017
GlobalID uses `autoload` for the class load.
https://github.com/rails/globalid/blob/c08e9a0a20e7b040d0ec5c55612afae8b40f16f6/lib/global_id.rb#L3..L9

In a thread-based backend like Sidekiq, there is a possibility that
autoload may occur simultaneously in multiple threads, and as a result,
it is presumed that an error may be caused by contention of autoload.

In order to avoid the above issue, explicitly loaded the class at startup.

Maybe fixes rails/globalid#101
y-yagi added a commit to y-yagi/globalid that referenced this issue Aug 12, 2017
In a thread-based backend like Sidekiq, there is a possibility that
autoload may occur simultaneously in multiple threads, and as a result,
it is presumed that an error may be caused by contention of autoload.

In order to avoid the above issue, eager load the constants on boot.
Maybe fixes rails#101
y-yagi added a commit to y-yagi/globalid that referenced this issue Aug 12, 2017
In a thread-based backend like Sidekiq, there is a possibility that
autoload may occur simultaneously in multiple threads, and as a result,
it is presumed that an error may be caused by contention of autoload.

In order to avoid the above issue, eager load the constants on boot.
Maybe fixes rails#101
y-yagi added a commit to y-yagi/globalid that referenced this issue Aug 12, 2017
In a thread-based backend like Sidekiq, there is a possibility that
autoload may occur simultaneously in multiple threads, and as a result,
it is presumed that an error may be caused by contention of autoload.

In order to avoid the above issue, eager load the constants on boot.
Maybe fixes rails#101
y-yagi added a commit to y-yagi/globalid that referenced this issue Aug 14, 2017
In a thread-based backend like Sidekiq, there is a possibility that
autoload may occur simultaneously in multiple threads, and as a result,
it is presumed that an error may be caused by contention of autoload.

In order to avoid the above issue, eager load the constants on boot.
Maybe fixes rails#101
y-yagi added a commit to y-yagi/globalid that referenced this issue Aug 15, 2017
In a thread-based backend like Sidekiq, there is a possibility that
autoload may occur simultaneously in multiple threads, and as a result,
it is presumed that an error may be caused by contention of autoload.

In order to avoid the above issue, eager load the constants on boot.
Maybe fixes rails#101
y-yagi added a commit to y-yagi/globalid that referenced this issue Aug 15, 2017
In a thread-based backend like Sidekiq, there is a possibility that
autoload may occur simultaneously in multiple threads, and as a result,
it is presumed that an error may be caused by contention of autoload.

In order to avoid the above issue, eager load the constants on boot.
Maybe fixes rails#101
@simondelacourt
Copy link

I noticed the issue is still present in the current 0.4.0 version of the Gem,

this is the backtrace:

vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/arguments.rb:78:in deserialize_argument'
vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/arguments.rb:109:in block in deserialize_hash' vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/arguments.rb:109:in transform_values'
vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/arguments.rb:109:in deserialize_hash' vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/arguments.rb:87:in deserialize_argument'
vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/arguments.rb:109:in block in deserialize_hash' vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/arguments.rb:109:in transform_values'
vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/arguments.rb:109:in deserialize_hash' vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/arguments.rb:87:in deserialize_argument'
vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/arguments.rb:39:in block in deserialize' vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/arguments.rb:39:in map'
vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/arguments.rb:39:in deserialize' vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/core.rb:135:in deserialize_arguments'
vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/core.rb:125:in deserialize_arguments_if_needed' vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/execution.rb:32:in perform_now'
vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/execution.rb:22:in block in execute' vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:108:in block in run_callbacks'
vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/railtie.rb:26:in block (4 levels) in <class:Railtie>' vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/execution_wrapper.rb:85:in wrap'
vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/reloader.rb:68:in block in wrap' vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/execution_wrapper.rb:81:in wrap'
vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/reloader.rb:67:in wrap' vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/railtie.rb:25:in block (3 levels) in class:Railtie'
vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in instance_exec' vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in block in run_callbacks'
vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:135:in run_callbacks' vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/execution.rb:20:in execute'
vendor/bundle/ruby/2.4.0/gems/activejob-5.1.4/lib/active_job/queue_adapters/sidekiq_adapter.rb:40:in perform' vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:199:in execute_job'
vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:170:in block (2 levels) in process' vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/middleware/chain.rb:128:in block in invoke'
vendor/bundle/ruby/2.4.0/gems/scout_apm-3.0.0.pre10/lib/scout_apm/background_job_integrations/sidekiq.rb:81:in call' vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/middleware/chain.rb:130:in block in invoke'
vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.4.0.336/lib/new_relic/agent/instrumentation/sidekiq.rb:33:in block in call' vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.4.0.336/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:362:in perform_action_with_newrelic_trace'
vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.4.0.336/lib/new_relic/agent/instrumentation/sidekiq.rb:29:in call' vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/middleware/chain.rb:130:in block in invoke'
vendor/bundle/ruby/2.4.0/gems/appsignal-2.3.4/lib/appsignal/hooks/sidekiq.rb:35:in block in call' vendor/bundle/ruby/2.4.0/gems/appsignal-2.3.4/lib/appsignal.rb:197:in block in monitor_transaction'
vendor/bundle/ruby/2.4.0/gems/appsignal-2.3.4/lib/appsignal.rb:484:in instrument' vendor/bundle/ruby/2.4.0/gems/appsignal-2.3.4/lib/appsignal.rb:196:in monitor_transaction'
vendor/bundle/ruby/2.4.0/gems/appsignal-2.3.4/lib/appsignal/hooks/sidekiq.rb:26:in call' vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/middleware/chain.rb:130:in block in invoke'
vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/middleware/chain.rb:133:in invoke' vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:169:in block in process'
vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:141:in block (6 levels) in dispatch' vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/job_retry.rb:97:in local'
vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:140:in block (5 levels) in dispatch' vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/rails.rb:42:in block in call'
vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/execution_wrapper.rb:85:in wrap' vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/reloader.rb:68:in block in wrap'
vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/execution_wrapper.rb:85:in wrap' vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/reloader.rb:67:in wrap'
vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/rails.rb:41:in call' vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:136:in block (4 levels) in dispatch'
vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:215:in stats' vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:131:in block (3 levels) in dispatch'
vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/job_logger.rb:7:in call' vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:130:in block (2 levels) in dispatch'
vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/job_retry.rb:72:in global' vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:129:in block in dispatch'
vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/logging.rb:44:in with_context' vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/logging.rb:38:in with_job_hash_context'
vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:128:in dispatch' vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:168:in process'
vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:85:in process_one' vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:73:in run'
vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/util.rb:16:in watchdog' vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/util.rb:25:in block in safe_thread'
`

I've verified the version by

~ $ bundle show globalid /app/vendor/bundle/ruby/2.4.0/gems/globalid-0.4.0

Does anybody have some ideas how to get around this? It seems to happen quite early after the restart of the worker (which happens directly after a deploy).

@rafaelfranca
Copy link
Member Author

It should be fixed now in 0.4.1

@AlexWayfer
Copy link

With version 1.0.0 I still get such error in bin/rails console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants