-
Notifications
You must be signed in to change notification settings - Fork 434
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
Disk-full errors are not correctly reported #280
Comments
I recommend the following approach:
|
Same issue for |
Avoids silent continuing after failed writes, because currently callers do not check the returned bool.
Some improvements for this in my branch: master...nh2:PoissonRecon:nh2fixes-v15.03 |
Avoids silent continuing after failed writes, because currently callers do not check the returned bool.
Another motivation for that:
|
In general, the code's IO design has a problem: It uses RAII for file resource handling. This is not robust, because only `fclose()` (or `fflush()`) is guaranteed to actually pass data to the OS, and thus surface potential errors. "RAII-for-files" requires that `fclose()` be put in C++ destructors. But destructors are not allowed to `throw`. Thus "RAII-for-files" cannot do proper error handling of failed writes. **C++ RAII cannot be used for file management.** Or anything where the cleanup action can fail. (Unless you're happy to swallow errors silently, which nobody should be.) This commit replaces all calls to `fwrite()` and `fclose()` by throwing_fwrite() throwing_fclose() fwrite_from_destructor() fclose_from_destructor() All variants try to report good error reasons, such as "no space left on device" (currently only imlemented for POSIX, not for Windows, where no error details are produced). The `*_from_destructor()` versions use non-allocating writes to `std::cerr` and terminate the program.
I'm furhter improving this situation in that branch with commit nh2@e155f45 |
Throughout the code, PoissonRecon does not check the return values of
write()
/fwrite()
correctly.While in some parts of the code there's certainly awareness that writes can fail, e.g. when the disk is full, such as here with a
bool
being returned:PoissonRecon/Src/Streams.h
Lines 70 to 77 in d4e8715
much of the code simply calls
write()
, ignoring the returned bool and continuing:PoissonRecon/Src/PoissonRecon.client.inl
Lines 1456 to 1457 in d4e8715
Because of this, you can get the client failing with:
and the server saying:
when in fact e.g. the
--tempDir
is full and the error should really beno space left on device
.The text was updated successfully, but these errors were encountered: