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

lost subprocess output during stop #11

Closed
mcdonc opened this issue Mar 30, 2011 · 1 comment
Closed

lost subprocess output during stop #11

mcdonc opened this issue Mar 30, 2011 · 1 comment
Labels

Comments

@mcdonc
Copy link
Member

mcdonc commented Mar 30, 2011

Heath Kehoe provides this analysis:

The problem with losing subprocess stdout/stderr when the subprocess is
stopped is caused by the self.drain() call in Subprocess::stop(). If I
remove the drain() call from the stop() method, the problem is fixed.

Here's why: The drain() method ends up calling handle_read_event() for
the POutputDispatcher instances connected to stdout and stderr (because
their readable() methods always return True while the pipe is still
open). So readfd() is called which will return an empty string because
there very likely isn't any data pending; and that causes
handle_read_event() to close the pipe. But the process is still running,
and about receive its stop signal, so any output it wants to generate
between getting the signal and exiting will be lost (and worse, if the
subprocess generates more than a little output, it may receive a
SIGPIPE. If it wasn't written to handle or ignore that signal, it'll
terminate uncleanly).

Since drain() is called again during Subprocess::finish(), which happens
after the process has actually exited, there's no need to call drain()
earlier.

@mcdonc
Copy link
Member Author

mcdonc commented Mar 30, 2011

Closed by e19cbc1.

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

No branches or pull requests

1 participant