Skip to content

Conversation

@Paol0B
Copy link
Contributor

@Paol0B Paol0B commented Jan 30, 2026

close #10308

Fix: tee -p (Linux) ensure_stdout_not_broken Can Hang Forever on Pipes

Problem
tee -p hangs indefinitely in normal pipelines (e.g., echo "test" | tee -p file | cat) on Linux.

Root Cause
ensure_stdout_not_broken() used POLLRDBAND which doesn't work with standard Unix pipes, causing improper pipe state detection.

Solution
Changed poll flag from POLLRDBAND to POLLOUT:

Correctly detects broken pipes via POLLERR (automatically checked by poll)
Uses zero timeout (non-blocking)
Properly handles both healthy and broken pipes

Changes
signals.rs: Updated ensure_stdout_not_broken() to use POLLOUT
tee.rs: Restored pre-check with better documentation
test_tee.rs: Added regression test test_pipe_mode_normal_pipeline_no_hang

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/shuf/shuf-reservoir (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/sort/sort-stale-thread-mem (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)

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.

tee -p (Linux) ensure_stdout_not_broken Can Hang Forever on Pipes

2 participants