Everything has been working fine with defer, until I started to load
test my system. Just to give a bit more details, here is what I am
doing (simplified, only showing messages related things):
EventMachine.run do
foo_queue.subscribe do |payload|
... do stuff
ex.publish(stuff, :routing_key => "fooA")
operation = proc {
... do stuff including access to the DB. Returns result ##
Section A
ex.publish(stuff, :routing_key => "fooA")
result
}
callback = proc {|result|
if result
ex.publish(stuff, :routing_key => "fooA") ## Section B
end
}
EventMachine.defer(operation, callback)
end
end
It is difficult to understand exactly what is failing, but I am
getting errors such as:
In Section A: <internal:prelude>:8:in `lock': deadlock detected
(fatal)
In Section B: /usr/lib64/ruby/gems/1.9.1/gems/amq-client-0.9.8/lib/amq/
client/async/adapter.rb:247:in `send_frame': Trying to send frame
through a closed connection. Frame is #<AMQ::Protocol::MethodFrame:
0x007f3b049fbd98 @payload="\x00<
\x00(\x00\x00\x00\x1E941359_test_machine\x00", @channel=1>
(AMQ::Client::ConnectionClosedError)
It "looks like" (I don't know to be honest) a thread safety issue, but
I am not sure how to address this.
Thanks a lot
PJ
On Nov 14, 1:16 am, PJ <
wamre...@googlemail.com> wrote:
> Thanks a lot Michael. Defer is really helpful!
>
>
>
>
>
>
>
> On Wednesday, November 14, 2012 12:56:49 AM UTC, Michael Klishin wrote:
>
> > 2012/11/14 PJ <
wamr...@googlemail.com <javascript:>>