Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

EventMachine::defer stuck in operation block #127

Closed
meetme2meat opened this Issue · 1 comment

2 participants

@meetme2meat

Well I found EventMachine::defer to be working very fine until I Got this weird issue
To Exactly let you know what the issue is
Let me describe my architecture first (because I don't know how to describe the issue)
I am sending a data from a server to other server(running on eventmachine) using AMQP

The data is in serialize format (YAML possible) .The EventMachine has a defer statement which has a operation block which accept message from the queue parse and process it and return the result to callback to further processing.

What I notice is that the operation block seem to stuck after picking the message from the queue and do nothing

Here my code to better explain it.

EventMachine::run {
EventMachine::add_periodic_timer(10) {
EventMachine::defer(@operation_block,@callback_block)
}
}
@operation_block = Proc.new {
//pick message for the queue

message = queue.pop
if message
// Reach here
puts message // Display the message on console but never run the code below it (some how stuck and never move forward) and do nothing after this.

yaml_message = YAML.load(message)

// Processing logic
end

I hope I manage to address the issue problem without confusing it

@tmm1
Owner

This is likely because you are raising an exception in the defer block which is killing the worker thread. Try adding this to the top of your script:

Thread.abort_on_exception=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.