elharo opened a new issue, #12585:
URL: https://github.com/apache/maven/issues/12585
# BuildPlanExecutor: Concurrent writes to shared MavenSession from multiple
threads
**Found in:** maven-4.0.x branch
**File:**
`impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutor.java`
(lines 566-568)
**Severity:** Critical
## Description
`session.setCurrentProject()` is called from multiple executor threads with
no synchronization on the same `MavenSession` instance:
```java
private void attachToThread(BuildStep step) {
BuildPlanExecutor.attachToThread(step.project);
session.setCurrentProject(step.project); // concurrent write to shared
session
}
```
This is called from `executeStep()` which runs inside executor callbacks
from a thread pool. Multiple threads concurrently write to the **same**
`MavenSession` instance with no synchronization. This is a data race that can
lead to:
1. Incorrect `currentProject` values in concurrently executing mojos
2. Corrupted internal session state
3. Thread A reading the project set by Thread B
--
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]