You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2026/08/30 21:32:24 UTC

[PR] Forward port #12961: assign FastTerminal before starting the build thread [maven]

gnodet opened a new pull request, #12962:
URL: https://github.com/apache/maven/pull/12962

   ## Summary
   
   Forward port of #12961 to master.
   
   Fixes a race condition introduced in #12921: the `FastTerminal` constructor started its build thread before returning, so `MessageUtils.terminal` was still `null` when the build thread ran the builder callback — a race between the constructor returning and the thread scheduling. This caused a `NullPointerException` in CI ([example](https://github.com/apache/maven/actions/runs/33327782193/job/99318899899)):
   
   ```
   NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null
   ```
   
   The fix splits construction from start: `MessageUtils` now assigns the field **before** calling `FastTerminal.start()`, and `Thread.start()` provides the happens-before edge that makes the assignment visible to the build thread without additional synchronization.
   
   - `FastTerminal`: extract `start()` method from constructor, document the publish-before-start contract  
   - `MessageUtils.systemInstall()`: assign `terminal` field, then call `start()`  
   - New test `terminalAssignmentIsVisibleFromBuilderCallback` that asserts `MessageUtils.getTerminal()` is non-null from the builder callback
   
   ## Test plan
   
   - [x] `FastTerminalReentrancyTest` — all 5 tests pass (4 existing + 1 new)
   - [x] Full `maven-jline` module test suite passes
   - [ ] CI validates on Java 17/21/25
   
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Forward port #12961: assign FastTerminal before starting the build thread [maven]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #12962:
URL: https://github.com/apache/maven/pull/12962


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org