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

_subprocess: Fix pip install log window not showing #567

Closed
wants to merge 4 commits into from

Conversation

tetsuo-cpp
Copy link
Contributor

@tetsuo-cpp tetsuo-cpp commented Mar 23, 2023

Related to #536. I noticed this when debugging something else. For some reason, when we read stderr in the polling loop, it causes us to read nothing for stdout. There's no reason that we need to read stderr in the loop since it's not getting dumped into the log window so I just moved this code out of the loop.

@tetsuo-cpp tetsuo-cpp requested review from woodruffw and di March 23, 2023 05:41
Comment on lines +54 to +56
* Fixed an issue where the log window that we use to display `pip-audit`'s
dependency resolution progress was not showing anything
([#567](https://github.com/pypa/pip-audit/pull/567))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs relocating under [Unreleased] 🙂

Comment on lines +60 to +63
# NOTE(alex): For reasons I'm unsure about, reading the stderr stream in
# real time seems to interfere with stdout and cause us to read nothing.
# Let's wait until the process is terminated before reading stderr.
stderr = process.stderr.read() # type: ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm a little worried this might cause deadlocks in some (unlikely) conditions: I can imagine a case where pip writes to stderr before stdout and blocks waiting for the parent's corresponding read, meaning that process.poll() never sees a process termination (and stdout.read(bufsize) always results in an empty read).

Specifically, that should only happen if pip writes enough to stderr to saturate the underlying pipe buffer. But that might happen, so it's probably worth root causing what's going on here instead of deferring the stderr read.

@tetsuo-cpp
Copy link
Contributor Author

This code is going to be reworked as part of #574 so let's see if that fixes it.

@tetsuo-cpp tetsuo-cpp closed this Apr 24, 2023
@tetsuo-cpp tetsuo-cpp deleted the alex/log-window-fix branch April 24, 2023 02:23
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