Forked children cause assertion failure #59

Closed
lox opened this Issue Jun 16, 2012 · 17 comments

Comments

Projects
None yet
7 participants
@lox

lox commented Jun 16, 2012

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 comment has been minimized.

Show comment
Hide comment
@lox

lox Jun 16, 2012

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

lox commented Jun 16, 2012

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

@mkoppanen

This comment has been minimized.

Show comment
Hide comment
@mkoppanen

mkoppanen Jul 9, 2012

Owner

I shall take a look

Owner

mkoppanen commented Jul 9, 2012

I shall take a look

mkoppanen added a commit that referenced this issue Jul 9, 2012

@mkoppanen

This comment has been minimized.

Show comment
Hide comment
@mkoppanen

mkoppanen Jul 9, 2012

Owner

Can you test 25414ce ?

Owner

mkoppanen commented Jul 9, 2012

Can you test 25414ce ?

mkoppanen added a commit that referenced this issue Jul 9, 2012

mkoppanen added a commit that referenced this issue Jul 9, 2012

@igorw

This comment has been minimized.

Show comment
Hide comment
@igorw

igorw Jul 9, 2012

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

igorw commented Jul 9, 2012

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

@mkoppanen

This comment has been minimized.

Show comment
Hide comment
@mkoppanen

mkoppanen Jul 9, 2012

Owner

Did you try the latest?

Owner

mkoppanen commented Jul 9, 2012

Did you try the latest?

@igorw

This comment has been minimized.

Show comment
Hide comment
@igorw

igorw Jul 10, 2012

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

igorw commented Jul 10, 2012

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

@mkoppanen

This comment has been minimized.

Show comment
Hide comment
@mkoppanen

mkoppanen Jul 10, 2012

Owner

Can you provide code that I can test with?

Owner

mkoppanen commented Jul 10, 2012

Can you provide code that I can test with?

@igorw

This comment has been minimized.

Show comment
Hide comment
@igorw

igorw Jul 10, 2012

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

igorw commented Jul 10, 2012

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

@intarstudents

This comment has been minimized.

Show comment
Hide comment
@intarstudents

intarstudents Jul 23, 2012

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

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

@kballenegger

This comment has been minimized.

Show comment
Hide comment
@kballenegger

kballenegger Aug 24, 2012

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.

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 comment has been minimized.

Show comment
Hide comment
@cameronjacobson

cameronjacobson Oct 25, 2012

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/

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

This comment has been minimized.

Show comment
Hide comment
@scragg0x

scragg0x Nov 9, 2012

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

scragg0x commented Nov 9, 2012

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 added a commit that referenced this issue Dec 1, 2012

@mkoppanen

This comment has been minimized.

Show comment
Hide comment
@mkoppanen

mkoppanen Dec 1, 2012

Owner

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

Owner

mkoppanen commented Dec 1, 2012

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

@igorw

This comment has been minimized.

Show comment
Hide comment
@igorw

igorw Dec 1, 2012

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

igorw commented Dec 1, 2012

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

@mkoppanen

This comment has been minimized.

Show comment
Hide comment
@mkoppanen

mkoppanen Dec 1, 2012

Owner

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

$c = new ZmqContext (1, false);

Owner

mkoppanen commented Dec 1, 2012

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

$c = new ZmqContext (1, false);

@igorw

This comment has been minimized.

Show comment
Hide comment
@igorw

igorw Dec 1, 2012

Nice, that fixes it.

igorw commented Dec 1, 2012

Nice, that fixes it.

@mkoppanen

This comment has been minimized.

Show comment
Hide comment
@mkoppanen

mkoppanen Dec 2, 2012

Owner

Closing for now, please reopen if the issue persists.

Owner

mkoppanen commented Dec 2, 2012

Closing for now, please reopen if the issue persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment