Repository navigation
Hold stderr lock when using stdout through Console APIs. - #17360
Conversation
| } | ||
| } | ||
|
|
||
| fn with_stderr_lock<F>(f: F) where F: FnOnce() { |
There was a problem hiding this comment.
Could you add a comment here on why is it needed?
| Self::send_to_devtools(global, LogLevel::Log, message); | ||
| } | ||
| with_stderr_lock(move || { | ||
| for message in messages { |
There was a problem hiding this comment.
Also, I wonder whether we should split this loop (and the others) into two, one that does the printing with the lock held, and other that calls send_to_devtools.
I say that, because as far as I can tell, that function can panic and log (it uses downcast, which calls get_dom_class, which does trace!, which writes to stderr I think). I'd expect this to deadlock with RUST_LOG=trace, wouldn't it? or is the lock re-entrant? If it is, please comment on it.
There was a problem hiding this comment.
The stderr lock is reentrant, yes.
|
@bors-servo r+ |
|
📌 Commit b29d0c6 has been approved by |
Hold stderr lock when using stdout through Console APIs. This addresses a longstanding source of intermittent test failures where the stderr and stdout outputs get interleaved and the test harness becomes confused. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #12797 - [X] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17360) <!-- Reviewable:end -->
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
This addresses a longstanding source of intermittent test failures where the stderr and stdout outputs get interleaved and the test harness becomes confused.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is