Specify timeout when running cmd_list in CleanUnknownWorker#182
Open
FrostyX wants to merge 1 commit intopraiskup:mainfrom
Open
Specify timeout when running cmd_list in CleanUnknownWorker#182FrostyX wants to merge 1 commit intopraiskup:mainfrom
FrostyX wants to merge 1 commit intopraiskup:mainfrom
Conversation
48a3478 to
a29dcc0
Compare
praiskup
reviewed
Apr 2, 2026
|
|
||
| for line in iter(sp.stdout.readline, b''): | ||
| captured_string = b"" | ||
| for line in lines: |
Owner
There was a problem hiding this comment.
This has never worked for me when it comes to "live logs". I'd swear I tried PYTHONUNBUFFERED, too -- I'm a bit afraid to touch those lines :-/
praiskup
reviewed
Apr 2, 2026
| stdout=subprocess.PIPE, stderr=logfile) as sp: | ||
| captured_string = b"" | ||
| try: | ||
| stdout, _stderr = sp.communicate(timeout=timeout) |
Owner
There was a problem hiding this comment.
This may lead to an OOM error, if the tooling behind gets mad and provides GBs on a single line.
praiskup
reviewed
Apr 2, 2026
|
|
||
| # When the command is written in Python, it probably buffers its output | ||
| # and therefore it could be empty in case the subprocess it timeouts. | ||
| env["PYTHONUNBUFFERED"] = "1" |
Owner
There was a problem hiding this comment.
do you aim at subprocesses here?
Collaborator
Author
|
I have an easy reproducer with all corner-cases here I am planning to incorporate the code into this PR if we agree that the approach is correct. |
a29dcc0 to
ecbfc3a
Compare
| # We encountered EOF but we still have unprocessed bytes | ||
| elif buffer: | ||
| # Treat partial line as a complete line | ||
| # TODO do we want this or rather discard the incomplete line? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #178