gnodet opened a new issue, #353:
URL: https://github.com/apache/maven-clean-plugin/issues/353

   ## Problem
   
   `BackgroundCleaner.scanForLeftovers()` scans the fast staging directory at 
session start and queues any leftover directories (from killed previous builds) 
for background deletion. However, it does not handle the case where **two 
concurrent builds share the same staging directory** (e.g. two builds running 
simultaneously against the same `${project.build.directory}`).
   
   In that scenario one build's leftover scan could delete directories that are 
actively being used by the other build.
   
   ## Current behavior
   
   Matches the behavior of 3.5.0 before PR #286 (the old singleton also had no 
concurrency guard). The regression introduced by PR #286 was the loss of 
`scanForLeftovers()` entirely; PR #347 restored it without adding a guard, to 
keep scope limited.
   
   ## Proposed fix
   
   Either:
   - An **age filter**: only treat a staged directory as a leftover if it is 
older than some threshold (e.g. 30 seconds), making it unlikely to belong to a 
running build.
   - A **marker file**: write a per-build marker into the staging directory at 
session start; `scanForLeftovers()` skips any staged directory whose marker 
belongs to a running process (PID check).
   
   An age filter is simpler and good enough for most cases. A PID-based marker 
is more robust but more complex.
   
   ## Related
   
   - PR #347 (session-scoped `BackgroundCleaner`, batch retry) — acknowledged 
this as deferred, matches 3.5.0 behavior
   - `BackgroundCleaner.scanForLeftovers()`


-- 
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]

Reply via email to