Fix InputStreamMonitor.writeNext() wait() not in loop - #2882
Merged
Merged
Conversation
Contributor
vogella
force-pushed
the
issue-2881
branch
2 times, most recently
from
September 2, 2026 09:35
016cc7d to
cf249d3
Compare
vogella
previously requested changes
Sep 3, 2026
vogella
left a comment
Contributor
There was a problem hiding this comment.
The added !fClosed check is wrong and introduces a loop. After the console EOF action calls closeInputStream(), the monitor thread keeps running until the process exits, and with this change writeNext() no longer waits but returns immediately, so the while (fThread != null) loop in write() spins at full CPU.
Existing tests pass because none of them keep the thread alive after closeInputStream() but our production code does that.
Correct would be while (fQueue.isEmpty())
robstryker
added a commit
to redhat-developer/rsp-server
that referenced
this pull request
Sep 21, 2026
Remove !fClosed from the wait loop condition. After closeInputStream() sets fClosed, the condition caused writeNext() to return immediately, making the writeLoop() spin at full CPU until close() sets fThread to null. See: eclipse-platform/eclipse.platform#2882 (review) Fixes #764 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
robstryker
force-pushed
the
issue-2881
branch
from
September 21, 2026 21:22
0d7c015 to
4efc062
Compare
Contributor
|
Please squash both commits into one. |
Use while loop instead of if to guard Object.wait() against spurious wakeups per JLS 17.2.1. Fixes eclipse-platform#2881
robstryker
force-pushed
the
issue-2881
branch
from
September 21, 2026 22:21
4efc062 to
0b4f8ff
Compare
Contributor
Author
|
Changes were made and squashed |
Contributor
|
Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
if (fQueue.isEmpty())towhile (fQueue.isEmpty() && !fClosed)aroundfLock.wait()inwriteNext()to guard against spurious wakeups per JLS 17.2.1!fClosedto avoid waiting on a closed streamThe existing
ifguard was added for bug 550834 but doesn't protect against spurious wakeups. Found via SpotBugs static analysis (WA_NOT_IN_LOOP).Fixes #2881
Test plan
InputStreamMonitorTestspass🤖 Generated with Claude Code