parallel: Problem of uninitialized constant

Hello,

Thank you for this gem.

But I have an issue in my Rails App. My app is hosted by Heroku. Sometimes in my delayed job worker, I have a “NameError: uninitialized constant”.

The Stack Trace:

3
File "/app/vendor/bundle/ruby/2.1.0/gems/parallel-1.6.1/lib/parallel.rb" line 408 in call
4
File "/app/vendor/bundle/ruby/2.1.0/gems/parallel-1.6.1/lib/parallel.rb" line 408 in call_with_index
5
File "/app/vendor/bundle/ruby/2.1.0/gems/parallel-1.6.1/lib/parallel.rb" line 288 in block (2 levels) in work_in_threads
6
File "/app/vendor/bundle/ruby/2.1.0/gems/parallel-1.6.1/lib/parallel.rb" line 419 in with_instrumentation
7
File "/app/vendor/bundle/ruby/2.1.0/gems/parallel-1.6.1/lib/parallel.rb" line 287 in block in work_in_threads
8
File "/app/vendor/bundle/ruby/2.1.0/gems/parallel-1.6.1/lib/parallel.rb" line 183 in block (2 levels) in in_threads

Do you have any idea, what’s going on ? And how to fix it ?

Thanks for your response.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 15 (8 by maintainers)

Commits related to this issue

Most upvoted comments

That might be a require vs threading issue … does it happen if you make sure the class is loaded before entering the parallel block ?

On Tue, Oct 27, 2015 at 7:35 AM, MaximeRDY notifications@github.com wrote:

Sorry for the delay, I don’t receive the notification from Github.

It’s one on my app/services.

This error is really weird because it’s happened randomly or maybe it’s seems at the first time when the dyno worker is created.

Because when the job failed, delayed-job restart the same one just after and I don’t have this error…

Maybe it’s my rails configuration 😕

See the full stack trace:

NameError: uninitialized constant Transports::Flights::Koedia::RequestAvailabilityForRoutes 1 File “/app/app/services/transports/flights/find_for_return_trip.rb” line 151 in koedia_request_by_trip 2 File “/app/app/services/transports/flights/find_for_return_trip.rb” line 20 in block in flight_journeys … 6 non-project frames 3 File “/app/vendor/bundle/ruby/2.1.0/gems/parallel-1.6.1/lib/parallel.rb” line 408 in call 4 File “/app/vendor/bundle/ruby/2.1.0/gems/parallel-1.6.1/lib/parallel.rb” line 408 in call_with_index 5 File “/app/vendor/bundle/ruby/2.1.0/gems/parallel-1.6.1/lib/parallel.rb” line 288 in block (2 levels) in work_in_threads 6 File “/app/vendor/bundle/ruby/2.1.0/gems/parallel-1.6.1/lib/parallel.rb” line 419 in with_instrumentation 7 File “/app/vendor/bundle/ruby/2.1.0/gems/parallel-1.6.1/lib/parallel.rb” line 287 in block in work_in_threads 8 File “/app/vendor/bundle/ruby/2.1.0/gems/parallel-1.6.1/lib/parallel.rb” line 183 in block (2 levels) in in_threads

And and line 151, I just call a class method like this : Transports::Flights::Koedia::RequestAvailabilityForRoutes.call_or_return_by_cache(routes, params)

In my configuration, I have this: config.threadsafe! unless $rails_rake_task

What did I do wrong ? I’ve tried to Google this error but I didn’t find any workaround … 😦

— Reply to this email directly or view it on GitHub https://github.com/grosser/parallel/issues/150#issuecomment-151519797.