Repository navigation
log: do not set O_NONBLOCK on stderr - #72818
Conversation
|
@batrick hey Patrick, do you mind reviewing this change? |
| * | ||
| * This isn't required on Windows. | ||
| */ | ||
| stderr_is_fifo = S_ISFIFO(info.st_mode); |
There was a problem hiding this comment.
I think what I had missed was:
Write requests of {PIPE_BUF} bytes or less shall not be interleaved with data from other threads performing write operations on the same pipe or FIFO. Writes of greater than {PIPE_BUF} bytes may have data interleaved, on arbitrary boundaries, with write operations by other threads, whether or not the O_NONBLOCK flag of the file status flags is set.
(I prefer not to cite the Linux man pages for POSIX behavior.)
| /* Writes of at most PIPE_BUF bytes to a FIFO are atomic, so | ||
| * Log::_log_stderr() writes in such chunks to keep e.g. buggy container | ||
| * runtimes from reading torn log lines, as long as a line fits in | ||
| * PIPE_BUF bytes. See IEEE Std 1003.1-2017. |
There was a problem hiding this comment.
| * PIPE_BUF bytes. See IEEE Std 1003.1-2017. | |
| * PIPE_BUF bytes. See write/pwrite in IEEE Std 1003.1-2017. |
There was a problem hiding this comment.
thanks! incorporated.
|
Adding |
2551130 fixed torn log lines on FIFO stderr by writing each line with a single write(2) per PIPE_BUF chunk, and also set O_NONBLOCK on stderr. The flag isn't needed for that: writes of up to PIPE_BUF bytes to a pipe are atomic in blocking mode too, see pipe(7). And it does harm. The flag lives on the open file description, so when stdout shares the pipe, as with "2>&1 | less" or subprocess with stderr=STDOUT, stdout turns non-blocking too, even after we exit. If the reader falls behind, cout gets EAGAIN and drops the rest of the output while the tool still exits 0. That's how crushtool's output in set-choose.t gets cut off on busy make check nodes. So keep the single-write path, but leave the flags alone. The EAGAIN handling stays in case someone else made the pipe non-blocking. Fixes: https://tracker.ceph.com/issues/66997 Signed-off-by: Kefu Chai <[email protected]>
a52f285 to
908b537
Compare
|
changelog:
|
|
jenkins test docs |
|
This PR has been added to wip-bharath8-testing-20261114.052149-main. |
|
This is an automated message by src/script/redmine-upkeep.py. I have resolved the following tracker ticket due to the merge of this PR: No backports are pending for the ticket. If this is incorrect, please update the tracker |
2551130 fixed torn log lines on FIFO stderr by writing each line with a single
write(2)perPIPE_BUFchunk, and also setO_NONBLOCKon stderr. The flag isn't needed for that: writes of up toPIPE_BUFbytes to a pipe are atomic in blocking mode too, see pipe(7).And it does harm. The flag lives on the open file description, so when stdout shares the pipe, as with "2>&1 | less" or subprocess with stderr=STDOUT, stdout turns non-blocking too, even after we exit. If the reader falls behind, cout gets EAGAIN and drops the rest of the output while the tool still exits 0. That's how crushtool's output in
set-choose.tgets cut off on busy make check nodes.So keep the single-write path, but leave the flags alone. The
EAGAINhandling stays in case someone else made the pipe non-blocking.Fixes: https://tracker.ceph.com/issues/66997
Signed-off-by: Kefu Chai [email protected]
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.