Coder Social home page Coder Social logo

amqp's People

Contributors

abscondment avatar careo avatar codahale avatar cremes avatar dj2 avatar dougbarth avatar jakedouglas avatar majek avatar michaelklishin avatar phs avatar tmm1 avatar tonyg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

amqp's Issues

Expose sync API for MQ#close (Channel.Close)

From the AMQP 0.8 specification: "Channel.Close (ID=60) ­ request a channel close : Sync request, carries content". Hence MQ#close should accept a callback which will be fired when we get back Channel.Close-Ok response.

Pops receiving Basic.GetEmpty behave unintuitively

When a 'pop' request is made to an empty queue, the broker responds with a Basic.GetEmpty. MQ#process_frame catches this case and delivers it to the consumer's #receive using nil header and body (around line 220), which is reasonable.

MQ::Queue#receive on the other end will wrap the nil headers in a new MQ::Header before passing it off, probably to the @on_pop block.

Unfortunately, there is no easy way for the pop block to know it was handed a nil header. Anything sent to MQ::Header#method_missing explodes (including #properties), so we're left with either looting the ivar directly out of the header and testing #nil? or baiting and trapping a NoMethodError in the delegation. Neither is very savory.

I am personally inclined to not create the MQ::Header at all in MQ::Queue#receive if it would wrap a nil underlying header. Alternatively I could see exposing the underlying header with an accessor or creating a singleton header null object. I would be against delegating #nil? (which I only bring up because I see #inspect was delegated, which drove me nuts for about 30 min before I realized what was happening.)

I would be happy to make a patch.

How to ensure that a single message is published?

Try running the following Ruby file:

require 'rubygems'
require 'mq'

EM.run {
  amq = MQ.new
  queue = amq.queue("whatev")
  queue.publish({"foo" => "bar"})
  break
}

The message is never published. If you remove the break, then it is. What should I be doing here to ensure that the message is sent, and then leave the EventMachine loop when it is?

MQ.queue and MQ::Queue.new doco incorrect for :passive option

The documentation for the :passive option of MQ.queue and MQ::Queue.new refers to Exchange rather than Queue:

"If set, the server will not create the exchange if it does not already exist. The client can use this to check whether an exchange exists without modifying the server state."

Setting a queue to :immediate => true causes crash

If you turn on :immediate to true then writing to a queue that doesn't have any listeners causes AMQP gem to throw an exception.

/Users/dj2/Development/AideRSS/core/vendor/amqp/lib/mq.rb:74:in process_frame': undefined methodarguments' for nil:NilClass (NoMethodError)
from /Users/dj2/Development/AideRSS/core/vendor/amqp/lib/amqp/client.rb:9:in process_frame' from /Users/dj2/Development/AideRSS/core/vendor/amqp/lib/amqp/client.rb:103:inreceive_data'
from /Users/dj2/Development/AideRSS/core/vendor/eventmachine/core-0.12.3/lib/eventmachine.rb:237:in `run_machine'

The problem seems to be that the AMQP::Protocol::Basic::Return packet isn't being processed in mq#process_frame so we end up not getting @method set properly.

Adding:
when Protocol::Basic::Return
@method = method

to the Frame::method section of the case fixes the issue but I'm pretty sure it's the completely wrong solution.

Subscriptions and services falling over

Hi,

I'm running 6 processes (3 across 2 ubuntu boxes) that each subscribe to and publish to a topic exchange. When there is a backlog of messages on rabbit (10,000 - 100,000) ruby processes die (without ruby errors or a core dump) or subscriptions are broken and never recover. This does not happen if the services pop the queues rather than subscribe.

Has anyone any ideas why this might be happening? Any help would be greatly appreciated.

Burt

Do not declare the queue if it already exist, raise an error if it exists, but has different options

If we declare a queue with {auto_delete: true} and then queue with the same name, but with {auto_delete: false}, it won't produce any error, even

MQ.queue("test", :nowait => false, :auto_delete => true)
MQ.queue("test", :nowait => false, :auto_delete => false)

Output from org.rabbitmq.tools.Tracer:

ch2 -> {#method<queue.declare>(ticket=1,queue=test,passive=false,durable=false,exclusive=false,auto-delete=true,nowait=false,arguments={}),null,""}
ch3 -> {#method<queue.declare>(ticket=1,queue=test,passive=false,durable=false,exclusive=false,auto-delete=false,nowait=false,arguments={}),null,""}
ch2 <- {#method<queue.declare-ok>(queue=test,message-count=0,consumer-count=0),null,""}
ch0 <- {#method<connection.close>(reply-code=530,reply-text=NOT_ALLOWED - parameters for queue 'test' in vhost '/' not equivalent,class-id=50,method-id=10),null,""}

Solaris: pr_eventmachine.rb:381:in `stop': not running (EventMachine::Error)

I get the following errors when tryinf to utilise any code that uses the worker pattern as used in prime.rb on Solaris 10:

$ ./primes.rb 2
/usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:381:in stop': not running (EventMachine::Error) from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:73:instop'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:451:in stop_event_loop' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:306:infork_reactor'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:in fork' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:infork_reactor'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:33:in fork' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:intimes'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:in fork' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:18:infork'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:244:in call' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:244:in``' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:244:ingenerate'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:284:in install_oneshot_timer' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:59:inadd_oneshot_timer'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:356:in add_timer' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:237:inrun'
/usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:381:in stop': not running (EventMachine::Error) from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:73:instop'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:451:in stop_event_loop' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:306:infork_reactor'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:in fork' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:infork_reactor'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:310:in fork_reactor' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:33:infork'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:in times' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:infork'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:18:in fork' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:244:incall'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:in fork' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:infork_reactor'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:33:in fork' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:244:in``' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:intimes'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:in fork' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp.rb:107:infork'
from ./primes.rb:17
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:244:in generate' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:284:ininstall_oneshot_timer'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:59:in add_oneshot_timer' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:356:inadd_timer'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:237:in run' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp.rb:84:instart'
from ./primes.rb:39
/usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:381:in stop': not running (EventMachine::Error) from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:73:instop'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:451:in stop_event_loop' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:306:infork_reactor'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:in fork' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:infork_reactor'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:33:in fork' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:intimes'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:in fork' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:18:infork'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:244:in call' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:244:in``' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:244:ingenerate'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:284:in install_oneshot_timer' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:59:inadd_oneshot_timer'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:356:in add_timer' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:237:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:310:in fork_reactor' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:infork'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:in fork_reactor' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:33:infork'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:in times' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:infork'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp.rb:107:in fork' from ./primes.rb:17 ["poller01-20260-577800", :started] /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:40:infork': undefined method call' for nil:NilClass (NoMethodError) from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:incall'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:in event_callback' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:342:inrun_timers'
from (eval):44:in each' from (eval):44:ineach'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:339:in run_timers' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:322:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in loop' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:in run_machine' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:310:in fork_reactor' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:infork'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:in fork_reactor' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:33:infork'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:in times' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:infork'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:18:in fork' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:incall'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:in select' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:incrank_selectables'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:324:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inloop'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:inrun_machine'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in run' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp.rb:84:instart'
from ./primes.rb:39
["poller01-20279-577800", :started]
/usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:40:in fork': undefined methodcall' for nil:NilClass (NoMethodError)
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:in call' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:inevent_callback'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:342:in run_timers' from (eval):44:ineach'
from (eval):44:in each' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:339:inrun_timers'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:322:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inloop'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:inrun_machine'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:310:infork_reactor'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:in fork' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:infork_reactor'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:33:in fork' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:intimes'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:in fork' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:18:infork'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:in call' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:inselect'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:in crank_selectables' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:324:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in loop' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:in run_machine' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp.rb:84:in start' from ./primes.rb:39 /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:40:infork': undefined method call' for nil:NilClass (NoMethodError) from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:incall'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:in event_callback' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:342:inrun_timers'
from (eval):44:in each' from (eval):44:ineach'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:339:in run_timers' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:322:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in loop' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:in run_machine' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:310:in fork_reactor' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:infork'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:in fork_reactor' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:33:infork'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:in times' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:infork'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:18:in fork' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:incall'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:in select' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:incrank_selectables'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:324:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inloop'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:inrun_machine'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in run' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp.rb:84:instart'
from ./primes.rb:39
/usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:40:in fork': undefined methodcall' for nil:NilClass (NoMethodError)
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:in call' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:inevent_callback'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:342:in run_timers' from (eval):44:ineach'
from (eval):44:in each' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:339:inrun_timers'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:322:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inloop'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:inrun_machine'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:310:infork_reactor'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:in fork' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:infork_reactor'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:33:in fork' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:intimes'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:in fork' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:18:infork'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:in call' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:inselect'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:in crank_selectables' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:324:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in loop' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:in run_machine' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp.rb:84:in start' from ./primes.rb:39 /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:40:infork': undefined method call' for nil:NilClass (NoMethodError) from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:incall'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:in event_callback' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:342:inrun_timers'
from (eval):44:in each' from (eval):44:ineach'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:339:in run_timers' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:322:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in loop' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:in run_machine' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:310:in fork_reactor' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:infork'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:in fork_reactor' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:33:infork'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:in times' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:infork'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:18:in fork' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:incall'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:in select' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:incrank_selectables'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:324:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inloop'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:inrun_machine'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in run' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp.rb:84:instart'
from ./primes.rb:39
/usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:40:in fork': undefined methodcall' for nil:NilClass (NoMethodError)
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:in call' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:inevent_callback'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:342:in run_timers' from (eval):44:ineach'
from (eval):44:in each' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:339:inrun_timers'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:322:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inloop'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:inrun_machine'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:310:infork_reactor'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:in fork' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:infork_reactor'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:33:in fork' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:intimes'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:in fork' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:18:infork'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:in call' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:inselect'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:in crank_selectables' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:324:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in loop' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:in run_machine' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp.rb:84:in start' from ./primes.rb:39 /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:40:infork': undefined method call' for nil:NilClass (NoMethodError) from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:incall'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:in event_callback' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:342:inrun_timers'
from (eval):44:in each' from (eval):44:ineach'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:339:in run_timers' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:322:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in loop' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:in run_machine' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:310:in fork_reactor' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:infork'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:in fork_reactor' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:33:infork'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:in times' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:infork'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:18:in fork' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:incall'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:in select' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:incrank_selectables'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:324:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inloop'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:inrun_machine'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in run' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp.rb:84:instart'
from ./primes.rb:39
[:checking, 10000]
[:checking, 10001]
/usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:40:in fork': undefined methodcall' for nil:NilClass (NoMethodError)
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:in call' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:inevent_callback'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:342:in run_timers' from (eval):44:ineach'
from (eval):44:in each' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:339:inrun_timers'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:322:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inloop'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:inrun_machine'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:310:infork_reactor'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:in fork' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:infork_reactor'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:33:in fork' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:intimes'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:in fork' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:18:infork'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp/client.rb:115:in call' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp/client.rb:115:inreceive_data'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1506:in event_callback' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:550:ineventable_read'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:548:in times' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:548:ineventable_read'
from (FORWARDABLE):3:in __send__' from (__FORWARDABLE__):3:ineventable_read'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:369:in crank_selectables' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:369:ineach'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:369:in crank_selectables' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:324:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in loop' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:in run_machine' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp.rb:84:in start' from ./primes.rb:39 ["prime checker poller01-20279-577800", :prime?, 10000] ["prime checker poller01-20279-577800", :prime?, 10001] /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:40:infork': undefined method call' for nil:NilClass (NoMethodError) from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:incall'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:in event_callback' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:342:inrun_timers'
from (eval):44:in each' from (eval):44:ineach'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:339:in run_timers' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:322:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in loop' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:in run_machine' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:inrun'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:310:in fork_reactor' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:infork'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:304:in fork_reactor' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:33:infork'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:in times' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:32:infork'
from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/ext/emfork.rb:18:in fork' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:incall'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:in select' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:366:incrank_selectables'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:324:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:inloop'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in run' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:inrun_machine'
from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in run' from /usr/local/lib/ruby/gems/1.8/gems/tmm1-amqp-0.6.4/lib/amqp.rb:84:instart'
from ./primes.rb:39
[:prime?, 10000, false]
[:prime?, 10001, false]
[:primes=, nil]

The source:


#!/usr/bin/env ruby


require 'rubygems'
require 'mq'

# check MAX numbers for prime-ness
MAX = 2

# logging
def log *args
  p args
end

# spawn workers
workers = ARGV[0] ? (Integer(ARGV[0]) rescue 1) : 1
AMQP.fork(workers) do

  log MQ.id, :started

  class Fixnum
    def prime?
      ('1' * self) !~ /^1?$|^(11+?)\1+$/
    end
  end

  class PrimeChecker
    def is_prime? number
      log "prime checker #{MQ.id}", :prime?, number
      number.prime?
    end
  end

  MQ.rpc('prime checker', PrimeChecker.new)

end

# use workers to check which numbers are prime
AMQP.start(:host => 'localhost') do

  prime_checker = MQ.rpc('prime checker')

  (10_000...(10_000+MAX)).each do |num|
    log :checking, num

    prime_checker.is_prime?(num) { |is_prime|
      log :prime?, num, is_prime
      (@primes||=[]) << num if is_prime

      if (@responses = (@responses || 0) + 1) == MAX
        log :primes=, @primes
        EM.stop_event_loop
      end
    }
  end
end

This same script works fine on both OS X and Linux.

old/ directory in gem

Packging amqp for use in Fedora and I've noticed the old/ directory is shipped in the gem. Are these files required?

process_frame raises an error on Channel::Close instead of calling MQ.error

When a Channel::Close frame is received, an error is raised instead of calling MQ.error, causing the process to exit unless EM.error_handler is set. Here is a patch to correct this:

diff --git a/lib/mq.rb b/lib/mq.rb
index 893325f..b6cd901 100644
--- a/lib/mq.rb
+++ b/lib/mq.rb
@@ -222,7 +222,7 @@ class MQ
         end
 
       when Protocol::Channel::Close
-        raise Error, "#{method.reply_text} in #{Protocol.classes[method.class_id].methods[method.method_id]} on #{@channel}"
+        MQ.error "#{method.reply_text} in #{Protocol.classes[method.class_id].methods[method.method_id]} on #{@channel}"
 
       when Protocol::Channel::CloseOk
         @closing = false

stdout error msgs, unrecoverable state of client/consumer, apparent corruption of RabbitMQ database

In lib/amqp/client.rb I found this:
when Protocol::Connection::Close
# raise Error, "#{method.reply_text} in #{Protocol.classes[method.class_id].methods[method.method_id]}"
STDERR.puts "#{method.reply_text} in #{Protocol.classes[method.class_id].methods[method.method_id

That's actually handy when, for example, the AMQP broker (I use RabbitMQ 1.7.2) shuts down or becomes unavailable. Unfortunately, in some circumstances I also saw error messages passed through from RabbitMQ that indicated a queue's durability was inconsistent with the exchange--this usually happened after a reset or force_reset of RabbitMQ, but could also occur on the client (consumer) side if a client attempted to subscribe to an exchange that did not exist. It didn't matter whether I chose durable or not on the consumer side, I got the same error.

Once I got this error, it simply kept coming no matter what. The only solution was to stop and restart the client AFTER the publisher had sent a message--but there was no error thrown, so it was hard to know when to do it. Worse yet, somehow RabbitMQ itself would sometimes get corrupted after a client tried to subscribe to an exchange that didn't exist, and I had to do a "sudo rabbitmqctl force_reset" to clear all data in order to make the clients work at all.

I dealt with the most common situation by causing my clients to publish a message (content: 'ignore_me') prior to subscribing to an exchange.

This actually didn't work--the client would hang after publishing, and would not receive messages--until I moved the publish code (client-side, now) to a subprocess. That worked.

But I still occasionally ran into the issue with the error message about queue/exchange compatibility. So I un-commented the error-raising line in the code snippet above, which let me exit from the client & restart.

Unfortunately this meant my clients also died upon a broker disconnect. So I needed a good way to handle the error (a retry simply didn't work...I don't know why, but the app just hangs at that point).

Simultaneously with the above, I'd noticed that I got an annoying error when a client (actually this happened for either publisher or subscriber) couldn't initially connect to the broker. Attempting to handle this via a rescue/retry gave me a hanging app that never connected after a failure. This sort of thing could probably be handled by god or monit or something that monitors and restarts processes (whereas not raising any errors meant not handling the situation at all), but I wanted something cleaner.

So I made it all work by putting all AMQP code into a subprocess, such as the following publisher-side example:

def send_message(message, host, exchange, key)
  @exchange, @host, @message, @key = exchange, host, message, key
  cryptor = Cryptor.new
  @crypt_message = cryptor.encrypt_text @message, @key
  cryptor = nil
  begin
    fork do
      begin
        AMQP.start(:host => @host) do
          queue = MQ.fanout(@exchange, :durable => true)
          queue.publish(@crypt_message, :persistent => true)
          AMQP.stop {EM.stop}
        end
      rescue
        exit 99
      end
    end
    Process.wait
    raise "error sending message" unless $?.success?
  rescue
    sleep 5
    retry
  end

end

It works pretty much the same way on the subscriber-side. I really like the convenience of this gem, but...am I missing something, or should "do it all in subprocesses!" be part of the standard documentation? And isn't it better to raise errors than to write to STDOUT?

Even with all this, if I ever have to reset the RabbitMQ broker, I have to shut down and restart all consumer clients (because they're nearly immortal as written) or...and this is just weird...the broker will not accept any new messages. No errors get thrown on the publisher size, but queue length stays at zero.

I suppose I could make a client shut down via an AMQP message by spawning yet another subprocess that subscribes to a "shutdown" queue. I could "exit 99" from that process upon receiving such a message, then trap "CLD" from the parent process, and exit from that as well (assuming I was clever enough to verify it was the correct "child death," anyway).

Is all this really necessary? Though I suppose the way I'm handling this would probably work in any Rails environment without worrying about Phusion vs Mongrel vs Nginx vs Thin or whatever...I actually haven't tried that, but probably will.

Boils down to this: why no actual raised errors when we need them? Can that change?

Plus a bonus: what's corrupting RabbitMQ, anyway? Is it the gem, or a problem on their side?

COMMAND_INVALID - unimplemented method in AMQP::Protocol::Basic::Reject

On amqp 0.6.0, I get this error when calling header.reject(:requeue => true)

COMMAND_INVALID - unimplemented method in AMQP::Protocol::Basic::Reject

Interestingly, this error seems to result in a queue reconnect, which causes any unack'd messages to be requeued on the server. I believe disconnecting from the queue is the AMQP-specified method of noack'ing messages. However, the error message indicates this might be a side effect rather than intended.

Problems with JRuby and eventmachine >= 0.12.6

AMQP has problems under Windows OS with JRuby if eventmachine version isn't 0.12.6-java.

With version 0.12.8-java it throws an exception

With 0.12.10-java it simply "forgets" messages if no :timeout parameter is set, and if setted, only the first message is sent; rest of messages /dissapear/

Bug in MQ.reset

I found that that there is bug in handling reconnecting in MQ class. When method reset is called it replaces @exchanges variable with Hash but method exchanges initializes it with instance of MQ::Collection, so when reconnecting occurs @exchanges becomes Hash and sending messages fails. Also occasionally some elements in @exchanges are nil.

Patch: http://pastebin.com/39iiGd32

dependency issue with eventmachine

mq gem has a strong dependency with eventmachine, it works only with eventmachine gem not eventmachine-eventmachine more up-to-date gem I use.

When I install eventmachine-eventmachine (GitHub) gem I got this error:
/usr/local/lib/site_ruby/1.8/rubygems.rb:827:in `report_activate_error': Could not find RubyGem eventmachine (>= 0.12.4) (Gem::LoadError)

When I install eventmachine (rubyforge) gem, it works.

AMQP::Buffer::Overflow while running as a daemon

I'm running a few daemons using daemon-kit and every so often one of them crashes with a Buffer::Overflow exception. I'm not sure of the best way to go about debugging this, but wanted to post it in case someone had a solution or suggestion.

E, [2010-03-10T16:15:53.662666 40042] ERROR -- : AMQP::Buffer::Overflow (AMQP::Buffer::Overflow)
/opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/amqp/buffer.rb:252:in `_read'
/opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/amqp/buffer.rb:95:in `read'
/opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/amqp/buffer.rb:88:in `map'
/opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/amqp/buffer.rb:88:in `read'
/opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/amqp/buffer.rb:102:in `read'
/opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/amqp/buffer.rb:88:in `map'
/opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/amqp/buffer.rb:88:in `read'
/opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/amqp/frame.rb:61:in `parse'
/opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/amqp/buffer.rb:243:in `extract'
/opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/amqp/frame.rb:60:in `parse'
/opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/amqp/client.rb:115:in `receive_data'
/opt/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
/opt/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
/opt/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/amqp.rb:79:in `start'
/opt/local/lib/ruby/gems/1.8/gems/daemon-kit-0.1.8pre/lib/daemon_kit/amqp.rb:35:in `run'
/opt/local/lib/ruby/gems/1.8/gems/daemon-kit-0.1.8pre/lib/daemon_kit/amqp.rb:20:in `run'

Raising an exception within AMQP

Hello,

I have an use case in which I need to raise an exception with an event machine loop. But on doing so the entire process hangs and become unresponsive.

Any suggestion on how to raise and catch exceptions within an event loop?

Thanks
Sriram.

comparison of Array with Array failed

[Fri, /home/tester/vendor/gems/gems/amqp-0.6.5/lib/amqp/buffer.rb:252:in min': comparison of Array with Array failed (ArgumentError) from /home/tester/vendor/gems/gems/nanite-0.4.1.10/lib/nanite/cluster.rb:137:ineach'
from /home/tester/vendor/gems/gems/nanite-0.4.1.10/lib/nanite/cluster.rb:137:in min' from /home/tester/vendor/gems/gems/nanite-0.4.1.10/lib/nanite/cluster.rb:137:inleast_loaded'
from /home/tester/vendor/gems/gems/nanite-0.4.1.10/lib/nanite/cluster.rb:23:in __send__' from /home/tester/vendor/gems/gems/nanite-0.4.1.10/lib/nanite/cluster.rb:23:intargets_for'
from /home/tester/vendor/gems/gems/nanite-0.4.1.10/lib/nanite/mapper.rb:198:in send_request' from /home/tester/vendor/gems/gems/nanite-0.4.1.10/lib/nanite/mapper.rb:191:inrequest'
from tester.rb:56:in start' from /home/tester/vendor/gems/gems/eventmachine-0.12.10/lib/em/timers.rb:51:incall'
from /home/tester/vendor/gems/gems/eventmachine-0.12.10/lib/em/timers.rb:51:in fire' from /home/tester/vendor/gems/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:incall'
from /home/tester/vendor/gems/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in run_machine' from /home/tester/vendor/gems/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:inrun'

It continues to happen repeatedly till the system is restarted.

gemspec not valid in HEAD

the gemspec should have README as README.md otherwise rake gem will abort with a Gem::InvalidSpecificationException

With ruby 1.9, Queue#publish wouldn't work for multi-byte characters.

With ruby 1.9 (tested with 1.9.1p378), Queue#publish wouldn't work for multi-byte characters.

#encoding:utf-8
require 'rubygems'
require 'mq'

AMQP.start do
  queue = MQ.queue('rubyist')
  EM.add_periodic_timer(1) do
    queue.publish("matz")
    queue.publish("まつもとゆきひろ")
  end
end
#=> publish only "matz"

User more AMQP-compliant terminology

I found it really frustrating that the terminology sometimes doesn't correspond to the AMQP specification. For example the MQ should be named Channel. It would be nice to address such issues, so that it is easier for users of the amqp gem to apply general AMQP advice and documentation.

Nil pointer error in AMQP::Queue.new

If you try to pass a nil queue name to AMQP::Queue.new, the initialize method bombs with nil.empty? not being a valid method. This is on version 0.7.1 of the gem. That line is setting the name ivar to nil if the passed in name parameter is an empty string. It seems that it should check that name is not nil first.

@name = name unless name.empty?

NoMethodError: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.empty?
[GEM_ROOT]/gems/amqp-0.7.1/lib/amqp/queue.rb:72:in `initialize'
[GEM_ROOT]/gems/amqp-0.7.1/lib/amqp/channel.rb:619:in `new'
[GEM_ROOT]/gems/amqp-0.7.1/lib/amqp/channel.rb:619:in `queue'

No support for accessing server-generated Queue/Exchange names & crash with name: "" and {nowait: false}

Currently the default option for Queue.Declare is {nowait: true}. When we want to use the server-generated names and we also want to safely wait for the response using {nowait: false}, AMQP just blows.

The Backtrace

amqp/lib/mq.rb:212:in `process_frame': undefined method `receive_status' for nil:NilClass (NoMethodError)
from amqp/lib/amqp/client.rb:9:in `process_frame'
from amqp/lib/amqp/client.rb:118:in `receive_data'
from gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
from gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
from amqp/lib/amqp.rb:79:in `start'
from test.rb:10:in `<main>'

The Code

MQ::Queue#initialize:

@mq.queues[@name = name] ||= self # name is an empty string

MQ#process_frame(frame):

when Protocol::Queue::DeclareOk
  # name is "amq.gen-bEXbprJylEeoY7Z8VdrIEA=="
  queues[ method.queue ].receive_status method

It's very obvious what's going on, I don't think it needs further explanation.

Related Issues

It very likely introduces other errors, for example if I'd want to create two anonymous queues on the same exchange, it'd create them, but the MQ#queues would refer only the last one, because the key is still an empty string. (Because it does @queues[""] = a_queue and then @queues[""] = another_one).

Possible Solutions

With Preserving Type of MQ#queues

The problem is that we can use either {nowait: true} which means we don't get the Queue.Declare-Ok response from server or {nowait: false} where we expect to get the response from the server (and in case the name is auto-generated, we really need to access the response object). The logical implication is that we need to run the registration in callback (which runs after we get the Queue.Declare-Ok), so I can imagine it introduces a problem if someone expects the registration run, but in fact it might be just waiting for the response. Plus if someone expects to access amq.queues[""], it won't work anymore. Here's how I think the code should look like:

With a Callback (New Syntax)

queue = amq.queue("") do |response| # with callback it'll default to {nowait: false}
  puts "~ Queue #{response.name} declared ..."
end

queue.callback { |response| }
queue.errback { |error| }

Without a Callback (Old Syntax)

amq.queue("foo").bind # ... the same as usual, it'll default to {nowait: true}

Incompatible Changes

If someone will declare a queue with nowait: true and an empty string as a name, we should raise an exception, because we don't have clue about the queue.name. It implicates that Queue has to be include EM::Deferrable.

With Changing MQ#queues to an Array or Array-Like Collection

So we can register all the queues immediately, and some queues will simply have queue.name == nil. If we'll use an array-like collection and define collection[name], then it should be reasonably backwards-compatible and we won't risk that users will suffer from weird errors when they expect the queue to be registered, but it's not (yet). Syntax will be the same as in the previous solution. I think this is the way to go. (Opinions?)

Note

I'm working on this issue, I don't need any help, but I'd really appreciate any thoughts on this subject, especially if anyone has a better idea how to fix it. Cheers.

CHANNEL_ERROR - unexpected method in connection state running in AMQP::Protocol::Channel::Open

I run into the following error after sending 33,000 message, and this error can be reproduced. I don't know why and where's wrong with. Could you please give me some comments?

CHANNEL_ERROR - unexpected method in connection state running in AMQP::Protocol::Channel::Open

environment:
RabbitMQ Server: 2.0.0-2.1
rubygem-amqp: 0.6.7-2.9
rubygem-ruote-amqp: 2.1.11.lbt2-2.7
python-amqplib: 0.6.2.proposed1-6.1
rubygem-ruote: 2.1.11.lbt2-2.7

eventmachine not initialized in thin

I'm on rails 3.0rc2 and ruby 1.9.2. When I add:
AMQP.connect(:host => "localhost", :user => "guest", :pass => "guest", :vhost => "/")

to an initializer and run thin start, I get:
eventmachine.rb:714:in `connect_server': eventmachine not initialized: evma_connect_to_server (RuntimeError)

It's my understanding that thin should already be running a reactor. Am I doing something wrong?

Thanks!

Stack level too deep for in lib/amqp/spec.rb:101

This occurs when running rspec on a rails project with bundler 0.9.9. We are not actually requiring amqp directly -- it is a gem dependency of minion.

/Users/ajsharp/.bundle/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/module/introspection.rb:9:in `parent_name': stack level too deep (SystemStackError)
        from /Users/ajsharp/.bundle/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/module/introspection.rb:31:in `parent'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:91:in `const_missing'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/amqp-0.6.7/lib/amqp/spec.rb:101:in `name'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/module/introspection.rb:9:in `parent_name'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/module/introspection.rb:31:in `parent'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:91:in `const_missing'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/amqp-0.6.7/lib/amqp/spec.rb:101:in `name'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/module/introspection.rb:9:in `parent_name'
         ... 7343 levels...
        from /Users/ajsharp/.bundle/ruby/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:14:in `load_files'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/rspec-1.3.0/lib/spec/runner/options.rb:133:in `run_examples'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/rspec-1.3.0/lib/spec/runner/command_line.rb:9:in `run'
        from /Users/ajsharp/.bundle/ruby/1.8/gems/rspec-1.3.0/bin/spec:5

mq.reset looses routing keys

While binding the queue with exchange, it stores the binding options in instance variable and in next line it removes :key from options. When amqp tries to reset queue after unbind/disconnect it uses the previously stored binding options, which no more has :key hence new queues are created without any routing keys.

I have already submitted the pull request for it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.