Skip to content

fc: service log rotation from the appender's own thread - #185

Merged
On1x merged 1 commit into
masterfrom
pm
Oct 25, 2026
Merged

On1x merged 1 commit into
masterfrom
pm

Conversation

@On1x

@On1x On1x commented Oct 25, 2026

Copy link
Copy Markdown
Member

The file appender used to schedule the next rotation with fc::async/fc::schedule on the
fiber queue of the thread that constructed it. vizd builds its loggers in main() and then
lives in boost::asio::io_context::run(), so that queue is never serviced again: the initial
rotation ran, the next task sat forever, and the node kept writing into a single file (measured
2026-10-20: 37 MB in 9 h on testnet, no new hourly file in 4 days on mainnet). While there,
_current_file_start_time was not updated in the "same hour" branch either.

Bumps thirdparty/fc to VIZ-Blockchain/fc@3968605 (merged into fc master): rotation is now
serviced by a dedicated std::thread (same approach as the snapshot plugin) — start()
performs the initial rotation synchronously, the timer sleeps in <=1 s slices until the next
boundary, shutdown joins the thread, and timer exceptions back off 1 s instead of terminating
or spinning. _current_file_start_time is written under slock.

No consensus impact: this is logging infrastructure only.

Verification (container on the project's boost-base-1.91 image, harness with main-thread
sleeps, i.e. the same threading picture as io_context::run()):

  • new code, 1 s interval, 4 s: 6 files, 40/40 lines, no losses or duplicates;
  • old code, same stand: 0 files without an fc pump, 2 files with one startup pump (the prod picture);
  • 3600 s interval: no spurious rotation.

Docs updated on all three locales: rotation is now serviced by the appender's own thread, and
binaries built before 2026-10-25 still need external logrotate.

Bumps thirdparty/fc to 3968605 (branch fix/log-rotation-timer-thread): the file
appender used to schedule rotations on the fc fiber queue of the thread that
built it, and vizd never services that queue after startup, so the hourly files
stopped after the first one (measured 2026-10-20: one 37 MB file in 9 h on
testnet, no new hourly files in 4 days on mainnet).

Docs (en, ru, zh-CN) now state that rotation is serviced by the appender's own
thread and that binaries built before 2026-10-25 still need external logrotate.
@On1x
On1x merged commit 5d418b2 into master Oct 25, 2026
6 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.

1 participant