-
-
Notifications
You must be signed in to change notification settings - Fork 2
fix: 🐞 Enhance atomic download by creating unique temporary file names to prevent race conditions #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…s to prevent race conditions Signed-off-by: Onuralp SEZER <[email protected]>
|
👋 Hello @onuralpszr, thank you for submitting a -✅ Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions. For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀 |
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 PR Review
Made with ❤️ by Ultralytics Actions
Good direction: generating per-download temp filenames addresses the .part race while keeping temp files in the destination directory for atomic rename. The main issue is the uniqueness scheme: using only subsec_nanos() (and defaulting to 0 on time errors) can still collide and can hide clock problems. Tightening the suffix to include full time (or a stronger uniqueness source) would make this robust under high concurrency.
💬 Posted 2 inline comments
Signed-off-by: Onuralp SEZER <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Signed-off-by: Onuralp SEZER <[email protected]>
|
Merged! Huge thanks to @onuralpszr (with contributions from @fcakyon and @artest08) for strengthening download safety in Ultralytics Inference. Swapping the fixed
This PR is exactly that kind of practical resilience: fewer race conditions, less chance of clobbered artifacts in CI/servers, and more reliable parallel inference workflows. Appreciate the care and craftsmanship—thank you all for helping make the stack more robust for everyone. |
🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Improves download safety by using uniquely named temp files to avoid collisions during concurrent downloads 🛡️⬇️
📊 Key Changes
<dest>.part) with a unique temp filename format:<filename>.part.<pid>.<timestamp_nanos>🧩"download"if missing) 🗂️🎯 Purpose & Impact