Repository navigation
Clean up file handle on interrupt, timeout - #56
gaborcsardi wants to merge 5 commits into
Conversation
|
I am a heavy user of filelock, through Thanks for this PR. It fixes the leak that hurts us most. Two failure paths still leak with this PR:
Descriptors left open on the lock file after 10 failed calls while another process holds the lock (Linux, R 4.6.1):
The patch is one line ( Two things we noticed while testing this branch: the vendored cleancall calls In case it helps, we also tried a version without cleancall, on current main: it closes the file on the failed returns and uses 🤖 Generated with Claude Code |
|
Thanks! FWIW the |
|
Thank you. The Windows failure was in the new test, not the fix: on Windows the wait loop closes the handle and raises "Locking interrupted for file …", so the condition is an error rather than an interrupt. The check that the file was closed already passed there. #58 now accepts that error on Windows and passes on all platforms: https://github.com/r-lib/filelock/actions/runs/38965602145 #58 covers what this PR does (closing the file on a timeout, an error or an interrupt while waiting) and also the timeout = 0 and Windows handle leaks, without the vendored cleancall. It does need R >= 3.5. If you agree, this PR could be closed in favour of #58. |
Closes #28.