gnodet opened a new pull request, #12323: URL: https://github.com/apache/maven/pull/12323
## Summary Re-forward-port of the GH-12301 fix from `maven-4.0.x` to `master`. The previous forward-port (#12317) was reverted because it broke `ConsumerPomBuilderTest.testSimpleConsumer`. **Root cause of the breakage:** The original fix used a shared `ConcurrentHashMap.newKeySet()` (`activeModelReads`) to track which POM files were being read by `doReadFileModel()`. When `PhasingExecutor` processes subprojects in parallel via `loadFilePom()`, thread A adding a path to the shared set would cause thread B's `getEnhancedProperties()` to skip reading that same model — even though there was no actual recursion, just parallel reads. **Fix:** Replace the shared `ConcurrentHashMap.newKeySet()` with a `ThreadLocal<Set<Path>>`. Each thread tracks only its own call stack, preventing actual recursive cycles (the StackOverflowError from GH-12301) without blocking legitimate parallel reads across threads. - `ThreadLocal<Set<Path>> activeModelReads` is added to `ModelBuilderSessionState` and shared across all `derive()`-d sessions - `doReadFileModel()` adds/removes the current path from the thread-local set - `getEnhancedProperties()` checks the thread-local set before reading the root model ## Test plan - [x] `ConsumerPomBuilderTest` (7 tests) — the test broken by the previous forward-port - [x] `DefaultModelBuilderTest` (12 tests) — model builder tests - [x] `MavenITgh12301StackOverflowInternalParentRevisionTest` — IT for the original issue Closes #12301 _Fully automatic review from 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
