Skip to content

Prevent hang by using non blocking reads - #30

Merged
Baptouuuu merged 1 commit into
mainfrom
fix-blocking-read
Oct 29, 2026
Merged

Baptouuuu merged 1 commit into
mainfrom
fix-blocking-read

Conversation

@Baptouuuu

@Baptouuuu Baptouuuu commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Problem

If a process outputs content to stderr and stdout is flagged as readable but without any content then iterating over $process->output() will hang forever and the process will be blocked by filling up its stderr buffer.

This happens because when fagged readable the process will read its content in a blocking way, however since there's no data it will wait forever for any data to arrive. But there will be no data since the process outputs to stderr only.

The precise reason why stdout is flagged as readable even though there's no data is not understood for now (that's why there's no anti regression test).

Solution

Read stdout/stderr in a non blocking way.

Note

Since the precise reason is not understood, this fix should be treated as an extra caution for something that might happen.

@Baptouuuu Baptouuuu self-assigned this Oct 29, 2026
@Baptouuuu Baptouuuu added the bug Something isn't working label Oct 29, 2026
@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.70%. Comparing base (6b680cd) to head (607792d).

Additional details and impacted files
@@             Coverage Diff              @@
##               main      #30      +/-   ##
============================================
- Coverage     90.74%   90.70%   -0.04%     
  Complexity      605      605              
============================================
  Files            58       58              
  Lines          2324     2325       +1     
============================================
  Hits           2109     2109              
- Misses          215      216       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Baptouuuu
Baptouuuu merged commit f860036 into main Oct 29, 2026
21 of 22 checks passed
@Baptouuuu
Baptouuuu deleted the fix-blocking-read branch October 29, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant