From b67d102c1eea34da67f91267550930717b6ed0aa Mon Sep 17 00:00:00 2001 From: Narasimha-sc <166327228+Narasimha-sc@users.noreply.github.com> Date: Mon, 19 Oct 2026 19:30:02 +0000 Subject: [PATCH] plans: chat console race: crash window --- plans/2026-10-19-terminal-items-race.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plans/2026-10-19-terminal-items-race.md b/plans/2026-10-19-terminal-items-race.md index 9bd58a51bc..52fe40575f 100644 --- a/plans/2026-10-19-terminal-items-race.md +++ b/plans/2026-10-19-terminal-items-race.md @@ -7,7 +7,7 @@ Issue #7755. `ChatModel.addTerminalItem(item, maxItems)` reads `terminalItems.value` for the size check, twice on the `subList` line (the list and its size), and again for the append, without a lock. While no chat console is open, it runs on the caller's thread: `sendCmd` on the IO dispatcher, the receiver loop, and the migration receivers, several at once. (With a console open, writes are posted to the main thread.) Two concurrent calls can: -- crash with `IndexOutOfBoundsException: toIndex = 201` in `subList`: another thread appended between the two reads of `terminalItems.value` in the `subList` line (that thread had skipped the trim on an out-of-date size check, so the list went past the cap); +- crash with `IndexOutOfBoundsException: toIndex = 201` in `subList`: another thread appended between the two reads of `terminalItems.value` in the `subList` line; - lose a row: both read the same list and the second write replaces the first; - keep the list above the cap.