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

FileHandle file resource may leak if the constructor throws an exception #607

Closed
kingcrimsontianyu opened this issue Jan 30, 2025 · 1 comment · Fixed by #614
Closed
Assignees
Labels
bug Something isn't working c++ Affects the C++ API of KvikIO

Comments

@kingcrimsontianyu
Copy link
Contributor

kingcrimsontianyu commented Jan 30, 2025

The constructor of FileHandle may create the following resources:

  • File resource created by the system call open without the O_DIRECT flag.
  • File resource created by the system call open with the O_DIRECT flag.

There are two possibilities where the constructor may throw exceptions and cause trouble:

  • The compatibility mode is set to OFF but the file cannot be opened with the O_DIRECT flag.
  • The compatibility mode is set to OFF but the cuFileHandleRegister fails, for instance, due to unsupported or misconfigured system for cuFile I/O.

When the constructor throws, the destructor will not be called, resulting in resource leak. This issue can be fixed by using an RAII file resource manager.

@kingcrimsontianyu
Copy link
Contributor Author

This issue has been resolved with #614 😺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working c++ Affects the C++ API of KvikIO
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants