Skip to content
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

review and improve error handling when invoking makedirs #1365

Merged
merged 2 commits into from
Jan 10, 2025

Conversation

petersilva
Copy link
Contributor

client ran into some error/crashes related to makedirs in downloading.
Reviewed all invocations.

  • if the file exists (but isn't a directory)... delete it before invoking makedirs
  • if the invocation fails... was doing bad things in a few cases. improved.

Copy link

github-actions bot commented Jan 8, 2025

Test Results

239 tests   234 ✅  1m 35s ⏱️
  1 suites    1 💤
  1 files      4 ❌

For more details on these failures, see this check.

Results for commit 98c55eb.

♻️ This comment has been updated with latest results.

@petersilva petersilva marked this pull request as ready for review January 8, 2025 21:21
@reidsunderland
Copy link
Member

I'm a bit worried about this one. Deleting a file that already exists and replacing it with a directory seems like kind of surprising behavior, at least to me.

It's probably a pretty rare situation, so maybe it's not a big deal.

I think there should at least be a warning logged when we delete the file, because that could help someone troubleshoot if they run into this.

@petersilva
Copy link
Contributor Author

The way the mirroring works, fine tuned order of operations is not assured. for All data types, not just files, we have a lot of code that deletes old versions of the files.... This is going a step further. I'm not super certain about it either, .. if you want can revert that (requires separate patch... since the changes are all in one commit.)

Want me to remove that file with the same name remove code?

@petersilva
Copy link
Contributor Author

oh... it will still solve the client problem, because the improved error handling is what was essential.

@petersilva
Copy link
Contributor Author

OK... I was testing the hpc-mirroring example, and the rm causes crashes and data loss when mirroring the linux kernel. I will remove that stuff.

If (usual case) there are multiple files in a directory,
then there is a race condition to create the directory, multiple
instances will see the directory is not there, and will run makedirs
to create it. the "loser" just won't create the directory... but with
unlink... the unlink fails (because directory exists.) and
then the operation fails. (not retried? FIXME?)

So I think it's better to leave that failure mode to humans.
@petersilva petersilva merged commit 86bc42c into development Jan 10, 2025
3 of 5 checks passed
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.

2 participants