cloudist icon indicating copy to clipboard operation
cloudist copied to clipboard

No `data` available to workers under ruby1.8

Open jperville opened this issue 14 years ago • 5 comments

I encountered the following exception when running the "make sandwich" examples with ruby1.8.

If I run ruby worker_client.rb 1 (to request only one sandwich because I'm not very hungry) worker code will appear to behave as intended the first time. But when I ask for another sandwich (either by running my command line again, or by asking for 2 sandwiches after restarting the worker) the second time, just after the "Finished" displays I see the following exception in the console where I have been running the worker.

julien@dev:/data/sandbox7$ ruby worker.rb
I, [2011-07-21T07:35:26.577251 #23390]  INFO -- : Started Worker
Prefetch: 1
I, [2011-07-21T07:35:26.578369 #23390]  INFO -- : AMQP Subscribed: queue=make.sandwich exchange=
I, [2011-07-21T07:35:31.311294 #23390]  INFO -- : JOB (2c285500-9589-012e-61b3-08002795e76b) Make sandwich with white bread
D, [2011-07-21T07:35:36.320343 #23390] DEBUG -- : Finished Job in 5.01775193214417 seconds
worker.rb:23: warning: Object#id will be deprecated; use Object#object_id
worker.rb:23: undefined local variable or method `data' for Cloudist:Module (NameError)
        from /var/lib/gems/1.8/gems/amq-client-0.7.0.alpha9/lib/amq/client/exchange.rb:101:in `call'
        from /var/lib/gems/1.8/gems/amq-client-0.7.0.alpha9/lib/amq/client/exchange.rb:101:in `publish'
        from /var/lib/gems/1.8/gems/amqp-0.8.0.rc9/lib/amqp/exchange.rb:457:in `publish'
        from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/em/deferrable.rb:47:in `call'
        from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/em/deferrable.rb:47:in `callback'
        from /var/lib/gems/1.8/gems/amqp-0.8.0.rc9/lib/amqp/channel.rb:253:in `once_open'
        from /var/lib/gems/1.8/gems/amqp-0.8.0.rc9/lib/amqp/exchange.rb:456:in `publish'
        from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `call'
        from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `run_deferred_callbacks'
        from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `each'
        from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `run_deferred_callbacks'
        from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
        from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
        from /var/lib/gems/1.8/gems/amqp-0.8.0.rc9/lib/amqp/connection.rb:39:in `start'
        from /var/lib/gems/1.8/gems/cloudist-0.4.3/lib/cloudist.rb:61:in `start'
        from worker.rb:19
julien@dev:/data/sandbox7$

If I run the same worker with ruby 1.9.2 (and the same version of installed gems) everything seems to run fine.

I have the following versions installed:

julien@dev:/data/sandbox7$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
julien@dev:/data/sandbox7$ gem -v
1.3.7
julien@dev:/data/sandbox7$ gem list

*** LOCAL GEMS ***

activesupport (3.0.9)
amq-client (0.7.0.alpha9)
amq-protocol (0.7.0)
amqp (0.8.0.rc9)
bundler (1.0.12)
cloudist (0.4.3)
eventmachine (0.12.10)
hashie (1.0.0)
i18n (0.6.0)
json (1.4.6)
macaddr (1.0.0)
uuid (2.3.2)
julien@dev:/data/sandbox7$

I can work around the problem by running the worker code with ruby 1.9.2 but I would prefer to work with 1.8, as I am trying to build an application with QtRuby that will also make good use of cloudist.

Sincerely, Julien

jperville avatar Jul 21 '11 05:07 jperville

Hi,

Thanks for pointing that out. It doesn't look like it will be hard to fix, I'll see if I can replicate and fix it shortly.

ivanvanderbyl avatar Jul 22 '11 00:07 ivanvanderbyl

Hello ivan,

For information, I upgraded my amq* gems to the latest from github and the problem disappeared with ruby 1.8. I now use the following version of amq gems :

julien@dev:/data/sandbox7$ gem list | grep amq
amq-client (0.7.0.beta10.pre)
amq-protocol (0.7.0.alpha8.pre)
amqp (0.8.0.rc14.pre)
amqp-spec (0.3.8)

I cross fingers for amq gems to hit 0.8 so that I can use official gems again.

Sincerely, Julien

jperville avatar Jul 22 '11 05:07 jperville

@jperville if you are using amqp 0.8.0.rc14.pre (current master), please also use amq-client master. And amq-protocol 0.8.0 is now on rubygems.org, I am slowly phasing out of pre-release dependencies (rc14 won't have any) because rubygems 1.3.7 cannot compare them properly.

michaelklishin avatar Jul 22 '11 07:07 michaelklishin

Also, please follow @rubyamqp, many smallish news that do not deserve ruby-amqp Google Group or rabbitmq-discuss announcements are posted there. amqp gem 0.8.0 is pretty close, however, I am investigating one rare sporadic concurrency issue and will not release RC14 until I fully understand & resolve it.

michaelklishin avatar Jul 22 '11 08:07 michaelklishin

Thank you very much michael. I will follow the twitter.

jperville avatar Jul 22 '11 08:07 jperville