From 21f7b99c5e8a450c91194747e2b59d83a990ab0b Mon Sep 17 00:00:00 2001 From: Anatoly Piskunov Date: Sun, 25 Oct 2026 18:18:00 +0100 Subject: [PATCH] fc: service log rotation from the appender's own thread 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. --- @l10n/ru/docs/node/configuration.md | 14 ++++++++------ @l10n/zh-CN/docs/node/configuration.md | 8 +++++--- docs/node/configuration.md | 14 ++++++++------ thirdparty/fc | 2 +- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/@l10n/ru/docs/node/configuration.md b/@l10n/ru/docs/node/configuration.md index 14691b9d6e..d59b0664d9 100644 --- a/@l10n/ru/docs/node/configuration.md +++ b/@l10n/ru/docs/node/configuration.md @@ -197,12 +197,14 @@ logger.p2p.level = warn logger.p2p.appenders = p2p ``` -Аппендер `file` НАСТРОЕН ротироваться по времени (новый файл каждый час, хранится сутки), -но ротация срабатывает только пока обслуживается очередь файберов fc, а `vizd` после старта -её не обслуживает (замер 20.10.2026: нода тестнета написала один файл на 37 МБ за девять -часов на уровне `info`, часовых файлов нет; нода мейннета проработала четыре дня без нового -файла). Не рассчитывайте, что аппендер ограничит размер, и помните: на `debug` нода может -писать гигабайты в час. Если нужен только свежий хвост, используйте опциональный +Аппендер `file` ротируется по времени: новый файл каждый час, хранится сутки. С 25.10.2026 +ротацию обслуживает собственный поток аппендера, поэтому она срабатывает независимо от +того, чем занят главный поток. Сборки, сделанные раньше, ротировались только пока +обслуживается очередь файберов fc, а `vizd` после старта её не обслуживает (замер 20.10.2026: +нода тестнета написала один файл на 37 МБ за девять часов на уровне `info`, часовых файлов +нет; нода мейннета проработала четыре дня без нового файла) — таким нодам по-прежнему нужен +внешний logrotate. В любом случае ротация ограничивает файл по ВРЕМЕНИ, а не по размеру: +на `debug` нода может писать гигабайты в час. Если нужен только свежий хвост, используйте опциональный capped-аппендер: один файл, в котором остаются последние `max_lines` строк (по умолчанию 10000, `0` — без ограничения). Он считает строки при записи и сжимается на месте, поэтому файл держится между `max_lines` и ~1.1 x `max_lines`, без всяких таймеров. Ноды, в конфиге diff --git a/@l10n/zh-CN/docs/node/configuration.md b/@l10n/zh-CN/docs/node/configuration.md index f6a5f8a558..2f98359a4c 100644 --- a/@l10n/zh-CN/docs/node/configuration.md +++ b/@l10n/zh-CN/docs/node/configuration.md @@ -197,10 +197,12 @@ logger.p2p.level = warn logger.p2p.appenders = p2p ``` -`file` appender 已配置为按时间轮转(每小时一个新文件,保留一天),但只有在 fc -纤程队列被处理时轮转才会触发,而 `vizd` 启动后不再处理它(2026-10-20 实测:测试网节点在 +`file` appender 按时间轮转:每小时一个新文件,保留一天。自 2026-10-25 起,轮转由 +appender 自己的线程处理,因此无论主线程在做什么都会触发。更早构建的版本只有在 fc +纤程队列被处理时才会轮转,而 `vizd` 启动后不再处理它(2026-10-20 实测:测试网节点在 `info` 级别下九小时写了一个 37 MB 的文件,没有任何按小时的文件;主网节点运行四天也没有 -产生新文件)。不要指望它来限制文件大小,并注意在 `debug` 下节点每小时可能写出数 GB 日志。 +产生新文件)——这类节点仍需要外部 logrotate。无论哪种情况,轮转都按时间而不是按大小限制 +文件:在 `debug` 下节点每小时可能写出数 GB 日志。 如果只需要最近的尾部,请使用可选的 capped appender:单个文件,只保留最后 `max_lines` 行 (默认 10000,`0` 表示不限制)。它在写入时统计行数并在原文件上就地压缩,因此文件保持在 `max_lines` 与约 1.1 x `max_lines` 之间,不依赖任何定时器。配置中没有 diff --git a/docs/node/configuration.md b/docs/node/configuration.md index 98ff0d0ef5..0791440757 100644 --- a/docs/node/configuration.md +++ b/docs/node/configuration.md @@ -197,12 +197,14 @@ logger.p2p.level = warn logger.p2p.appenders = p2p ``` -The `file` appender is configured to rotate by time (a new file every hour, kept for a -day), but the rotation only fires while the fc fiber queue is serviced, and `vizd` does not -service it after startup (measured 2026-10-20: a testnet node wrote one 37 MB file in nine -hours at `info`, with no hourly files; the mainnet node ran four days without a new one). -Do not count on it to bound a file, and be aware that at `debug` a node can write -gigabytes per hour. If all you need is the recent tail, use the optional capped appender: +The `file` appender rotates by time: a new file every hour, kept for a day. Since +2026-10-25 the rotation is serviced by the appender's own thread, so it fires regardless of +what the main thread does. Binaries built before that date only rotated while the fc fiber +queue was serviced, and `vizd` does not service it after startup (measured 2026-10-20: a +testnet node wrote one 37 MB file in nine hours at `info`, with no hourly files; the mainnet +node ran four days without a new one) — such nodes still need external logrotate. Either +way, rotation bounds the file by time, not by size: at `debug` a node can write gigabytes +per hour. If all you need is the recent tail, use the optional capped appender: a single file that keeps only the last `max_lines` lines (default 10000, `0` = unlimited). It counts lines as it writes and compacts itself in place, so the file stays between `max_lines` and about 1.1 x `max_lines`, with no timer involved. Nodes whose config has no diff --git a/thirdparty/fc b/thirdparty/fc index 8ea25a26f3..3968605373 160000 --- a/thirdparty/fc +++ b/thirdparty/fc @@ -1 +1 @@ -Subproject commit 8ea25a26f3ab30f671855b5f0449c051058380bf +Subproject commit 3968605373af0fe9774d28ac77691a6ee55b0329