Conversation
…nt calls Guard getTerminal() instead of individual methods so every delegate is covered — JLine 4.4.0's FFM provider initialization reaches back through arbitrary terminal methods on the build thread. The DumbTerminal fallback output is wrapped with FilterOutputStream to prevent close() from closing the captured System.err. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
Closing in favor of the forward-port PR from the squash-merged #12921. |
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
Fixes Maven 4.0.0-rc-6 hanging on startup with JDK 25 in Linux container environments, and fixes a flaky
FastTerminalReentrancyTest.usingTheTerminalFromTheConsumerDoesNotDeadlockdeadlock observed across JDK 17/21/25 on ubuntu CI runners (example, example, example).Root cause:
FastTerminalonly guardedwriter()andgetType()against build-thread reentrancy. JLine 4.4.0's FFM provider initialization (CLibrary.<clinit>) andAnsiConsole.systemInstall()can reach back through other terminal methods (getSize,getName,encoding, etc.) on the build thread, causing a deadlock where the build thread waits on theCompletableFutureit is itself computing.Fix: Move the
isBuildThreadWaitingOnItself()guard intogetTerminal()— the single choke point all delegate methods pass through — backed by a pre-builtDumbTerminal. This covers all methods at once, including any new ones JLine may add.Improvements over #12921:
DumbTerminal's output stream is wrapped withFilterOutputStreamso thatclose()flushes instead of closing the capturedSystem.err—DumbTerminal.doClose()cascades to its writer's underlying stream, and closingSystem.errwould silently break stderr for the processwriter()andgetType(), along with the unusedfallbackWriterfield andfallbackWriter()method — the single guard ingetTerminal()makes them dead codeTest plan
writer()andgetType()still pass (4 tests, 10/10 stress runs)arbitraryTerminalMethodsFromTheBuilderDoNotDeadlockverifiesgetSize()from the builder callbackarbitraryTerminalMethodsFromTheConsumerDoNotDeadlockverifiesgetName()from the consumer callbackSupersedes #12921.
🤖 Generated with Claude Code