Repository navigation
test: the mock language server connects the clients of several starts at once without losing one - #2226
Merged
lagergren merged 1 commit intoNov 25, 2026
Conversation
… at once without losing one MockLanguageServer and MockTextDocumentService kept the clients of their connections in plain ArrayLists. Two starts of a mock server at the same time added to them concurrently, which threw ArrayIndexOutOfBoundsException in MockLanguageServer.addRemoteProxy and failed one of the starts with CannotStartServerException. That is how LSPSemanticTokenDocumentationProviderTest lost its second server's hover on CI, when redhat-developer#2224 started the server twice (fixed in redhat-developer#2225). Both lists are now CopyOnWriteArrayLists. MockTextDocumentService.reset clears its list instead of replacing it, under the lock which publishDiagnostics holds while it takes the first client and rotates the list.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2226 +/- ##
==========================================
- Coverage 55.52% 55.48% -0.05%
==========================================
Files 843 843
Lines 35939 35939
Branches 5638 7432 +1794
==========================================
- Hits 19955 19939 -16
- Misses 13097 13105 +8
- Partials 2887 2895 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
What
MockLanguageServerandMockTextDocumentServicekeep the clients of their connections in plainArrayLists. Two starts of a mock server at the same time add to them concurrently. That threwArrayIndexOutOfBoundsExceptioninMockLanguageServer.addRemoteProxyand failed one of the starts withCannotStartServerException.This is how
LSPSemanticTokenDocumentationProviderTest.testPlainTextOfTwoLanguageServerslost its second server's hover on CI: #2224 started the server twice, and #2225 fixes that. With #2225 that test no longer starts a server twice, but any test that starts two connections to one mock at once could still hit the same exception.Change
Test only.
CopyOnWriteArrayLists, so concurrent adds, and iteration throughMockLanguageServer.getRemoteProxies(), are safe.MockTextDocumentService.reset()clears its list instead of replacing it, under the lock thatpublishDiagnosticsholds while it takes the first client and rotates the list.Tests
No new test: the race needs two starts of one mock at once, which #2225 removes from the suite. The evidence is the stack trace that the investigation of #2224 found on CI.
The whole suite passes headless on IC 2024.2 and 2025.3: 2,422 tests each, 0 failures, with the 7 skipped tests that were already disabled.