Files
Matt GodboltandClaude Fable 5 9aea5183ca Remove temp directories per request instead of leaving them to the sweep
The queue-idle sweep in lib/handlers/compile.ts is the only thing that
removes temp directories on several common paths, and on a busy server
it rarely gets to run (compiler-explorer/infra#2310):

- Project builds (cmake, cargo, make, maven): finishProjectBuild deleted
  result.dirPath before calling doTempfolderCleanup, so the cleanup was
  a no-op. Regressed in #8174. The build directory is now made in
  buildProject and removed in a finally once execution, tools and
  post-processing are done with it.
- Interpreted languages: handleInterpreting never put its directory in
  the result, so nothing removed it. Removed in a finally.
- compile(): the handleUserError return and any throw from doCompilation
  or afterCompilation left the directory behind. Removed in a finally.
- getOrBuildExecutable: a failed build came back without dirPath, so the
  caller's cleanup had nothing to remove (and Kotlin asserted on it).
  Every result now carries the directory; a throw removes it.
- doExecution: a throw after the build leaked the build directory.
- execCompilerCached with createAndUseTempDir: a throw skipped both the
  release and the removal.
- LocalExecutionEnvironment: the package download directory was never
  removed. Callers now call cleanup() in a finally.
- racket opt-pipeline, sway forc project and dosbox scratch directories
  are removed once read.

ClangCompiler's afterCompilation override dropped delayCaching, so cmake
builds with clang cached and cleaned up as if they were single-file
compilations; it now passes it through.

Exposes ce_compilation_temp_dirs_already_gone and _held alongside the
existing temp dir metrics so per-request removal is visible against
what the sweep still finds.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L145mPEnhVYg8z7jHFT1gn
2026-08-19 08:19:21 -05:00
..
2026-07-02 18:26:35 +01:00
2025-07-28 10:34:46 -05:00
2026-05-23 14:47:16 +03:00