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

Errors on file close are silently ignored #21002

Open
adamreeve opened this issue Jan 30, 2025 · 2 comments
Open

Errors on file close are silently ignored #21002

adamreeve opened this issue Jan 30, 2025 · 2 comments
Labels
accepted Ready for implementation support

Comments

@adamreeve
Copy link
Contributor

We write Parquet files to network shares using Polars, and have found that closing a file occasionally returns an error that is ignored, so we have no indication that there was a failure. This is a wider issue with Rust rather than specific to Polars, eg. see rust-lang/rust#98338, but it would be very helpful for us if Polars could raise these errors when files are closed. For a stronger guarantee that data has been persisted, File::sync_all should be called, but this would have a performance impact for some users, and for the failure scenarios we're concerned about it would be sufficient to just check the return value of close.

Rust doesn't have a close method on files, but it should be possible to implement this fairly easily using the libc and winapi crates, see the close_file crate for example. I suspect that rather than adding a dependency on this old crate Polars might want to reimplement similar functionality.

I'd be happy to implement this change if it would be accepted.

@ritchie46
Copy link
Member

ritchie46 commented Jan 31, 2025

We understand this problem. It needs some research. The extension trait in close_file for instance doesn't prevent double closing of files. De drop call will close it again.

@ritchie46 ritchie46 added the accepted Ready for implementation label Jan 31, 2025
@adamreeve
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation support
Projects
None yet
Development

No branches or pull requests

2 participants