Skip to content

fix: move temp_dir cleanup after container stop in DockerCommandLineCodeExecutor.stop()#7390

Open
Jah-yee wants to merge 2 commits intomicrosoft:mainfrom
Jah-yee:fix/docker-temp-dir-cleanup-order
Open

fix: move temp_dir cleanup after container stop in DockerCommandLineCodeExecutor.stop()#7390
Jah-yee wants to merge 2 commits intomicrosoft:mainfrom
Jah-yee:fix/docker-temp-dir-cleanup-order

Conversation

@Jah-yee
Copy link

@Jah-yee Jah-yee commented Mar 13, 2026

Fixes #7383 - Ensures temporary directory cleanup happens after the Docker container is stopped, preventing potential issues with files being deleted while still in use by the container.

Changes

  • Moved temp_dir.cleanup() from the beginning of stop() method to the finally block
  • This ensures cleanup happens after the container is fully stopped

Jah-yee and others added 2 commits March 13, 2026 16:06
When output_dir is None, JupyterCodeExecutor creates a temp directory
via tempfile.mkdtemp() but never cleans it up in stop(). This leaks a
directory per executor lifetime.

Fixes microsoft#7382
…odeExecutor.stop()

Fixes microsoft#7383 - Ensures temporary directory cleanup happens after the Docker
container is stopped, preventing potential issues with files being deleted
while still in use by the container.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant