Skip to content

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

2 participants