Skip to content

Conversation

@smarr
Copy link
Owner

@smarr smarr commented Jun 27, 2025

This PR changes how data is read from a benchmarking process when we run in verbose mode.

We need to make sure we read all data, thus:

  • read until the channel is closed
  • read until we find an EOF marker

Before returning, we need to wait for the process to terminate, so that we have the return code.

This fixes #289.

@OctaveLarose could you review this?

I debugged it and tried it out on yuria2.

smarr added 3 commits June 27, 2025 18:57
Instead of stopping when the process terminate, continue reading until all channels are closed.

Signed-off-by: Stefan Marr <git@stefan-marr.de>
The previous code lifelocked on the EOF markers, i.e., empty strings.

Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
@smarr smarr added the bug label Jun 27, 2025
@smarr smarr requested a review from Copilot June 27, 2025 20:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request enhances the subprocess output reading in verbose mode by ensuring that output from both stdout and stderr is fully captured until their respective channels are closed or an EOF marker is encountered, while ensuring the process termination is awaited.

  • Introduces EOF flags (stdout_eof and stderr_eof) for both stdout and stderr
  • Updates the read loop to check for closed channels and wait for process termination when no further data is available
  • Adjusts the select mechanism to read with a timeout
Comments suppressed due to low confidence (1)

rebench/subprocess_with_timeout.py:94

  • [nitpick] Add inline comments to explain the purpose and usage of the stdout_eof and stderr_eof flags to enhance code clarity.
            stdout_eof = False

ret = select(reads, [], [], 0.1)
for file_no in ret[0]:
if file_no == proc.stdout.fileno():
read = output_as_str(proc.stdout.readline())
Copy link

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

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

Consider refactoring the duplicated logic for handling stdout and stderr reads into a helper function to improve maintainability and reduce code repetition.

Copilot uses AI. Check for mistakes.
@coveralls
Copy link

coveralls commented Jun 27, 2025

Coverage Status

coverage: 85.003% (-0.1%) from 85.143%
when pulling 0951a2e on make-sure-to-read-all-data-from-stdouterr
into 33a6243 on master.

Signed-off-by: Stefan Marr <git@stefan-marr.de>
@OctaveLarose
Copy link
Contributor

Sorry, missed this. I've done no extensive testing, but I can confirm that this fixes my issue as defined in #289, indeed. Thanks!

@smarr smarr merged commit 79f93cc into master Jul 7, 2025
12 of 14 checks passed
@smarr smarr deleted the make-sure-to-read-all-data-from-stdouterr branch July 7, 2025 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: truncated output for some benchmarks when using -d

4 participants