Edit of
Tirenvi_05/31.Issue/0121.Bug log watchdog false
Top
/
Tirenvi_05
/
31.Issue
/
0121.Bug log watchdog false
[
Front page
] [
Edit
|
Diff
|
History
|
Attach
|
Reload
] [
New
|
Page list
|
Search
|
Recent changes
|
Help
]
-- Use page as template --
(no template pages)
** 現象・原因 [#t63c032e] + markdownのinsertでreconcileが走る? + get_tick()で比較しているバッファが違う + last_time の時計が違う + monitor off できない ** 対策 [#k1e25438] - last_tickをバッファ単位かカレント変わったらリセット -- アクティブなバッファだけ監視すれば良いのでリセットが正解? - 自分自身で変更する場合は抑止 - get_timestampを正しく使う - config.log.monitor : off で抑止できる様に ** 回避策 [#n29940f9] - output = "file" ** test case [#m767499a] **Summary [#f8d0868f] While typing in a markdown buffer containing tables, the error `[TIR][ERROR][log.lua:62] changedtick runaway detected` pops up as a notification on nearly every keystroke. The plugin itself keeps working correctly — the watchdog in `lua/tirenvi/util/log.lua` is false-positiving. **Root cause [#e85bb1dc] The watchdog in `monitor()` (`log.lua:50-75`) reports a runaway when `b:changedtick` advances by more than 100 between two log emissions less than 1s apart. Three problems combine to make it fire during normal use: + '''The plugin's own edits inflate changedtick.''' Auto-reconcile rewrites buffer lines on each keystroke (`state/buffer.lua` → `nvim_buf_set_lines`), so during continuous typing in a table the tick advances far faster than user keystrokes alone. The watchdog ends up flagging the plugin's own normal realignment work. + '''Ticks from different buffers are compared.''' `get_tick()` reads the ''current'' buffer's changedtick, but `last_tick` is a single global. After a buffer switch, the delta is computed between two unrelated buffers' ticks, which can be arbitrarily large. + '''`last_time` is shared between two clocks.''' `monitor()` writes `uv.now()` (ms) into `last_time`, while `get_timestamp()` writes `uv.hrtime()` (ns) into the same variable when `use_timestamp` is enabled, so the "< 1000" time gate is meaningless in that configuration. Additionally, the watchdog cannot be disabled: `config.log.monitor = false` only suppresses the stats prefix in `get_monitor()`, while `monitor()` itself runs unconditionally on every `emit()`. **Steps to reproduce [#ve01f855] + `require("tirenvi").setup()` with defaults (log output = notify). + Open a markdown file containing a table. + Type continuously inside the table in insert mode. + "changedtick runaway detected" notifications appear repeatedly. **Suggested fix [#ad5b1cbe] - Track `last_tick` per buffer (or reset it when the current buffer changes). - Exclude ticks consumed by the plugin's own `set_lines` reconcile edits, or raise the threshold substantially. - Give `monitor()` its own timestamp variable instead of sharing `last_time` with `get_timestamp()`. - Have `monitor()` respect `config.log.monitor` so users can opt out. **Environment [#x310f90e] - tirenvi.nvim @ 114417f - Neovim on macOS (Darwin 25.6.0) Workaround meanwhile: `setup({ log = { output = "file" } })` routes the noise to a log file instead of notifications.
Do not change timestamp
** 現象・原因 [#t63c032e] + markdownのinsertでreconcileが走る? + get_tick()で比較しているバッファが違う + last_time の時計が違う + monitor off できない ** 対策 [#k1e25438] - last_tickをバッファ単位かカレント変わったらリセット -- アクティブなバッファだけ監視すれば良いのでリセットが正解? - 自分自身で変更する場合は抑止 - get_timestampを正しく使う - config.log.monitor : off で抑止できる様に ** 回避策 [#n29940f9] - output = "file" ** test case [#m767499a] **Summary [#f8d0868f] While typing in a markdown buffer containing tables, the error `[TIR][ERROR][log.lua:62] changedtick runaway detected` pops up as a notification on nearly every keystroke. The plugin itself keeps working correctly — the watchdog in `lua/tirenvi/util/log.lua` is false-positiving. **Root cause [#e85bb1dc] The watchdog in `monitor()` (`log.lua:50-75`) reports a runaway when `b:changedtick` advances by more than 100 between two log emissions less than 1s apart. Three problems combine to make it fire during normal use: + '''The plugin's own edits inflate changedtick.''' Auto-reconcile rewrites buffer lines on each keystroke (`state/buffer.lua` → `nvim_buf_set_lines`), so during continuous typing in a table the tick advances far faster than user keystrokes alone. The watchdog ends up flagging the plugin's own normal realignment work. + '''Ticks from different buffers are compared.''' `get_tick()` reads the ''current'' buffer's changedtick, but `last_tick` is a single global. After a buffer switch, the delta is computed between two unrelated buffers' ticks, which can be arbitrarily large. + '''`last_time` is shared between two clocks.''' `monitor()` writes `uv.now()` (ms) into `last_time`, while `get_timestamp()` writes `uv.hrtime()` (ns) into the same variable when `use_timestamp` is enabled, so the "< 1000" time gate is meaningless in that configuration. Additionally, the watchdog cannot be disabled: `config.log.monitor = false` only suppresses the stats prefix in `get_monitor()`, while `monitor()` itself runs unconditionally on every `emit()`. **Steps to reproduce [#ve01f855] + `require("tirenvi").setup()` with defaults (log output = notify). + Open a markdown file containing a table. + Type continuously inside the table in insert mode. + "changedtick runaway detected" notifications appear repeatedly. **Suggested fix [#ad5b1cbe] - Track `last_tick` per buffer (or reset it when the current buffer changes). - Exclude ticks consumed by the plugin's own `set_lines` reconcile edits, or raise the threshold substantially. - Give `monitor()` its own timestamp variable instead of sharing `last_time` with `get_timestamp()`. - Have `monitor()` respect `config.log.monitor` so users can opt out. **Environment [#x310f90e] - tirenvi.nvim @ 114417f - Neovim on macOS (Darwin 25.6.0) Workaround meanwhile: `setup({ log = { output = "file" } })` routes the noise to a log file instead of notifications.
View Text Formatting Rules