3 suggestions
Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive for their assessments.
Optional improvements
[suggestion] · Failed block/undo writes abort instead of using fatal-error notifications
The checked-result design retains process-aborting storage errors instead of using existing fatal-error notifications, preventing normal node shutdown handling or host-controlled error handling.
Location: src/node/blockstorage.cpp:1171 (head).
Details and suggested fix
If fwrite reports a short write after the allocation-time disk-space guards pass, flush() returns false, but WriteBlock, WriteBlockUndo and the full-buffer path immediately Assert that result. The 64 KiB automatic flush can abort during serialization, so changing only the final assertions is insufficient. Prefer the existing fatal-error path over this documented abort contract. Retain std::exchange, latch automatic failures and stop buffering, then report false at the explicit flush. On failure, explicitly close AutoFile before destruction, log the position, and notify and return failure as the fclose handlers do. Assertions can remain for an unhandled destructor fallback, but not for an already reported error with no pending bytes. This preserves the no-retry behavior and avoids AutoFile's destructor Assume(IsNull()) after earlier successful writes. The gains are fatal-error reporting and allowing libbitcoinkernel hosts to stay alive, not guaranteed persistence during orderly shutdown: a full disk can still prevent chainstate/index flushing. The base could already terminate on final or persistent buffered-write failures, so this is a design recommendation, not a new crash regression.
[suggestion] · flush() leaves its non-retryable failure state undocumented
A retry can report success without writing the failed buffer, but the new bool API does not document that callers must abandon the writer after false.
Location: src/streams.h:714 (head).
Details and suggested fix
std::exchange clears m_buf_pos before write_buffer(), and the catch block returns false without restoring it. An immediate second flush() therefore returns true without writing anything. AutoFile also obfuscates the buffer in place before fwrite and advances m_position only on full success. If a short write has already written a prefix, further obfuscated writes can use a stale offset. Document that failure discards the pending bytes to prevent a destructor retry, that false is not retryable, and that callers must stop writing and abandon or close the destination. No current caller that retries or continues writing after false was found; both production call sites assert on failure.
[suggestion] · Write-error text has no stderr fallback before abort
When console logging is disabled and debug.log is unwritable, the storage exception can disappear from diagnostics even if stderr is captured.
Location: src/streams.h:718 (head).
Details and suggested fix
flush() catches the backend exception and sends e.what() only through LogError. The logger ignores FileWriteStr's result and provides no stderr fallback. The following Assert prints only the failed expression before aborting. A full filesystem shared by debug.log and the blk/rev files can therefore hide the exception text from the captured abort diagnostic. Keep the log entry and also write the exception text to stderr before returning false. Console logging is enabled by default without -daemon, and an independent logging callback can still preserve the message.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: Short-write diagnostics omit the operating-system error (earlier report)