Skip to content

Docker staging copies of mutation inputs are left in the project after an IDE restart #121

Open

Description

@roxblnfk

Description

For a remote interpreter that cannot see the IDE system dir (Docker, typically), PhpToolLauncher.share copies the mutation run's coverage inputs into the project, under <project>/.idea/testo/staging/<run started at>/, or else <working dir>/.testo-staging/<run started at>/ (with a * .gitignore). The copy is removed only by SharedDirectory.release(), and only the object of the session that launched the process holds it.

So the copy stays forever when that session ends before the release:

  • the IDE is closed or killed while Infection runs (also on main, where release sits in the service's finally);
  • with Decouple PHP integrations from the shared core #116, a stop that could not be confirmed (TestoToolOutcome.Unconfirmed): the release waits for confirmed termination, which a new session can never observe.

The copy is a full coverage-xml tree plus junit.xml, so on a large project it can be hundreds of megabytes inside the project directory — in the working directory variant, next to the user's sources. Nothing ever sweeps it: the archive's own retention (#116: 24 h grace for incomplete or unconfirmed runs) deletes the archive copy, not the staged one.

Proposed solution

Sweep the staging roots when a mutation run starts (off the EDT): delete every entry whose name, a <started at> timestamp, is older than TestoRunStore.INCOMPLETE_GRACE_MS and is not protected by a live protectInputs; remove the root when only its .gitignore is left, as release() already does. Alternatively record the staged path in mutation.json and delete it when that run's archive is pruned.

Additional context

Found while reviewing #116; that PR keeps uncertain processes' inputs on purpose, which makes the leak reachable without a crash.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions