Skip to content

Loading…

Forked children cause assertion failure #59

Closed
lox opened this Issue · 17 comments

7 participants

@lox

I'm trying wo write a worker that forks its self to process tasks. This means that the Context is created pre-fork. I'm running into a problem where when the child process exits, it triggers an assertion error (presumably) when it's trying to clean up the context/threads it inherited from the parent:

Assertion failed: ok (mailbox.cpp:84)

The code I'm using to produce this is here: https://gist.github.com/2939834
The error occurs on line 41, where the child calls exit();

Any ideas?

@lox

This commit fixes the same issue in pyzmq: minrk/pyzmq@08bb3a3

@mkoppanen
Owner

I shall take a look

@mkoppanen mkoppanen added a commit that referenced this issue
@mkoppanen Testing a fix for issue #59 25414ce
@mkoppanen
Owner

Can you test 25414ce ?

@mkoppanen mkoppanen added a commit that referenced this issue
@mkoppanen More fixes on #59 3c4ae7c
@mkoppanen mkoppanen added a commit that referenced this issue
@mkoppanen Added test for issue #59 0bb78f8
@igorw

This is weird. I'm having the same issue. I tried the fix and I only get the assert sometimes.

@mkoppanen
Owner

Did you try the latest?

@igorw

Yes, but it might be related to the fact that I am forking off two children. Could that be an issue?

@mkoppanen
Owner

Can you provide code that I can test with?

@igorw

I hope this is small enough for you to test with: https://gist.github.com/3083407

@intarstudents

Whats happening with this? Someone knows how to fix this?

@kballenegger

Oh, this explains why it's impossible to use recv in a phpsh repl, since phpsh forks every command…

I'd like to +1 this issue. It's a major pain point in using ømq from PHP.

@cameronjacobson

This isn't a solution to the problem, but I think the following project could be useful as a general solution to this category of problem:

http://supervisord.org/

@scragg0x

I had this issue and I made a wrapper class to make a lazy context/connection. It might help someone get around the issue. Example: https://gist.github.com/4043814

@mkoppanen mkoppanen added a commit that referenced this issue
@mkoppanen Add second test for bug #59 62d0da9
@mkoppanen
Owner

Can you clone latest head and run make test? Seems to work now

@igorw

My example (this one) still results in a failed assertion.

@mkoppanen
Owner

@igorw, try initialising the context as non-persistent:

$c = new ZmqContext (1, false);

@igorw

Nice, that fixes it.

@mkoppanen
Owner

Closing for now, please reopen if the issue persists.

@mkoppanen mkoppanen closed this
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.