Skip to content

Commit

Permalink
Removing lock file causes concurrency issues
Browse files Browse the repository at this point in the history
The lock file could be removed when the 2nd process gets the lock.
And then the 3rd process will lock on a different lock file handle.
Although the lock path stays the same.

1st proc gets the lock
2nd proc waits for the lock
1st proc releases the lock
1st proc removes the lock file
2nd proc gets the lock
3rd proc creates a new lock file and gets the lock
  • Loading branch information
beeender committed Sep 12, 2023
1 parent 8771331 commit 2b025e0
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/huggingface_hub/file_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -1461,11 +1461,6 @@ def _resumable_file_manager() -> Generator[io.BufferedWriter, None, None]:
_chmod_and_replace(temp_file.name, local_dir_filepath)
pointer_path = local_dir_filepath # for return value

try:
os.remove(lock_path)
except OSError:
pass

return pointer_path


Expand Down

0 comments on commit 2b025e0

Please sign in to comment.