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

Race in timely dataflow shutdown #154

Closed
frankmcsherry opened this issue May 1, 2018 · 2 comments
Closed

Race in timely dataflow shutdown #154

frankmcsherry opened this issue May 1, 2018 · 2 comments

Comments

@frankmcsherry
Copy link
Member

frankmcsherry commented May 1, 2018

@utaal observed that in situations where the communication threads are overloaded it is not unlikely that one process can complete all dataflows and exit before the communication thread has pushed the last of the progress messages to the other processes, causing them to hang in shutdown.

The root of the issue is that Rust's thread::spawn produces a result that if dropped detaches the thread, so that the main thread does not need to wait for it to complete before it exits. The send_loop thread is able to shut down, but the recv_loop thread runs forever and needs to have this result dropped (or be rewritten to notice when the socket closes).

@utaal had the proposal, which seems sane, that all we need to do is mem::forget the results from spawning the send_loop threads, as this is the only thread we need to keep alive (letting the recv_loop threads evaporate when the process exits should be fine, as we don't seem to need to receive to unblock other processes). The send_loop thread should exit when all of the MPSC send handles have been dropped (by workers), which should allow the main thread to exit cleanly but only once the send thread has sent everything it needs to send.

@frankmcsherry
Copy link
Member Author

Note: this fix is not correct, owing to what not-detaching a thread doesn't do (it doesn't keep anything around, if the main thread exits).

Instead, the dataplane_mockup branch waits on all threads, communication and worker, which should ensure that all pending sends happen before the process goes away.

@frankmcsherry
Copy link
Member Author

This should be fixed by #135.

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

No branches or pull requests

1 participant