Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tolerate concurrent removal during temporary folder cleanup - #1852

Open
betacatsling wants to merge 1 commit into
joblib:mainfrom
betacatsling:fix/remove-concurrently-deleted-directory
Open

Tolerate concurrent removal during temporary folder cleanup#1852
betacatsling wants to merge 1 commit into
joblib:mainfrom
betacatsling:fix/remove-concurrently-deleted-directory

Conversation

@betacatsling

Copy link
Copy Markdown

delete_folder checks that a directory exists, then calls os.listdir outside its retry handler. Another cleaner can remove that directory before listdir or rmtree, causing an otherwise successful cleanup to raise FileNotFoundError.

Handle directory listing inside the retry block and finish when the target has already disappeared. Existing permission errors continue to retry and raise. Tests simulate both races at filesystem-operation boundaries using actual temporary directories.

Validation: 2 regressions failed before, 10 existing/control cases passed; all 12 disk tests pass afterward. Ruff checks pass for changed files. Validation ran locally on CPU.

Implementation and validation were performed with AI assistance.

Fixes #1851.

@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.08%. Comparing base (677d669) to head (e4516ce).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1852      +/-   ##
==========================================
- Coverage   94.08%   94.08%   -0.01%     
==========================================
  Files          46       46              
  Lines        8087     8118      +31     
==========================================
+ Hits         7609     7638      +29     
- Misses        478      480       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Tolerate concurrent removal during temporary folder cleanup

1 participant