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

Fix race condition which causes output to be lost sometimes #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thomasjm
Copy link

There seems to be a race condition which can cause stdout/stderr output to be missed. I noticed this when a simple printf("Hello world\n") program would sometimes fail to print.

It happens when the final call to p.write_contents() happens in do_execute. At this time, the threads RealTimeSubprocess._stdout_thread and RealTimeSubprocess._stderr_thread may not have finished reading all the output.

To fix this, we call .join on both threads before the final p.write_contents().

@Fulguritus
Copy link

Thanks a lot! I took the liberty and integrated the commit into my branch of jupyter-c-kernel.

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

Successfully merging this pull request may close these issues.

2 participants