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

Call BNG using asyncio to avoid deadlock #516

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

Conversation

alubbock
Copy link
Member

In rare situations, when BNG outputs a lot of data to STDOUT
quickly and fills the buffer, PySB could lockup due to how
subprocess handles reading pipe buffers. The only way to
avoid this would be to disable streaming output from BNG,
which is often useful for debugging.

This PR calls BNG using Python's asyncio framework.
Reading STDOUT uses a timeout to avoid deadlocking.
If a timeout occurs, the process is checked to see if
it has exited, and any remaining data in the STDOUT
buffer is processed.

In rare situations, when BNG outputs a lot of data to STDOUT
quickly and fills the buffer, PySB could lockup due to how
subprocess handles reading pipe buffers. The only way to
avoid this would be to disable streaming output from BNG,
which is often useful for debugging.

This PR calls BNG using Python's asyncio framework.
Reading STDOUT uses a timeout to avoid deadlocking.
If a timeout occurs, the process is checked to see if
it has exited, and any remaining data in the STDOUT
buffer is processed.
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.

None yet

1 participant