Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safir_control must not be multithreaded due to fork() issue #306

Closed
DonOregano opened this issue Jun 4, 2016 · 2 comments
Closed

Safir_control must not be multithreaded due to fork() issue #306

DonOregano opened this issue Jun 4, 2016 · 2 comments
Labels
Milestone

Comments

@DonOregano
Copy link
Member

We have seen a few crashes where safir_control and/or dose_main crash with a message about "epoll reregistration" on Linux. It seems that on POSIX OS:es it is very difficult to be thread safe and do fork()/exec() calls, which is what safir_control currently does.

The asio documentation mentions the threading issue: http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/io_service/notify_fork.html

Also there are a few relevant stack overflow discussions:

https://stackoverflow.com/questions/21529540/how-do-i-handle-fork-correctly-with-boostasio-in-a-multithreaded-program

https://stackoverflow.com/questions/9362258/how-to-make-boost-asio-fork-safe

Simplest resolution is to make safir_control single-threaded.

@DonOregano DonOregano added the bug label Jun 4, 2016
@DonOregano DonOregano added this to the 6.3.1 milestone Jun 4, 2016
@DonOregano
Copy link
Member Author

Fixed, by making it single-threaded.
An issue might be that Communication and/or System Picture may start misbehaving.
In that case the solution might be to use the trick in one of the SO discussions above: fork a child while still single threaded and let it do the fork.
This latter solution might be desirable when we handle all processes.

@DonOregano DonOregano modified the milestones: 6.3.1, 6.3.2 Aug 18, 2016
DonOregano added a commit that referenced this issue Oct 10, 2017
…gle threading may cause high latency, maybe. This is basically a test. more to follow in later commits.
@DonOregano
Copy link
Member Author

This discussion appears very relevant:
klemens-morgenstern/boost-process#65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant