gnodet commented on PR #13955:
URL: https://github.com/apache/maven/pull/13955#issuecomment-6851391392
## CI Failure Analysis + Fix
### Root cause
All 9 integration-test jobs fail (all platforms, all JDKs) on the same
handful of tests: `MavenITmng7160ExtensionClassloader`,
`MavenITmng5382Jsr330Plugin`, `MavenITmng6084Jsr250PluginTest`,
`MavenITmng8648ProjectEventsTest`,
`MavenITgh13068LegacyPluginDependenciesResolverTest`,
`MavenITmng8445DiDumpTest`. These all passed on master the same day, so this is
not flakiness.
The problem is in the interaction between `createTerminal(context)` being
moved to the **first** step of `doInvoke()` (before `configureLogging()`) and
`doConfigureWithTerminal()` being called from the `onComplete` background
callback in `MessageUtils.systemInstall()`.
**The sequence that breaks:**
1. `createTerminal()` → starts DeferredTerminal background build
2. Background thread completes terminal → fires `onComplete` → calls
`doConfigureWithTerminal(context, terminal)`
3. `doConfigureWithTerminal` →
`doConfigureWithTerminalWithRawStreamsDisabled()` →
`context.loggerFactory.getLogger("stdout")` → **NullPointerException** (because
`configureLogging()` hasn't run yet, so `context.loggerFactory == null`)
4. The NPE is silently swallowed on the background thread → `System.out` is
**never replaced** with `LoggingOutputStream`
5. Plugin output via `System.out.println()` bypasses the SLF4J routing →
text never appears in Verifier's captured log → `verifyTextInLog()` fails
### Previous fix commit `f76faae940`
That commit correctly handled the embedded path (which failed with
`UnsupportedOperationException` from `buildDeferred()`), but the **system
terminal path** still called `doConfigureWithTerminal()` from the background
thread's `onComplete` — the NPE was still there.
### Fix applied (pushed as a new commit)
Remove `doConfigureWithTerminal()` from all callback paths in
`createTerminal()`. Instead, `doInvoke()` now:
```java
configureLogging(context);
// Wait for background terminal build to finish — loggerFactory is now set.
MessageUtils.awaitTerminalInitialization();
doConfigureWithTerminal(context, context.terminal);
activateLogging(context);
```
This applies uniformly to all three `createTerminal` paths
(system/DeferredTerminal, embedded/synchronous, pre-set), is race-free, and
preserves the startup performance benefit
(validate/pushProperties/configureLogging still run concurrently with the
terminal build).
The commit is at `4871f063eb` on `gnodet/jline-deferred-terminal`.
---
> *Reviewed by Hermès — [HERMES-BOT]*
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]