mirror of
https://github.com/xcat2/confluent.git
synced 2026-08-27 17:16:42 +00:00
95d6c96363
nodeconsole spawned a task per input byte from the stdin reader callback and kept no reference to it. Two of those tasks overlap as soon as one parks in relay_keypresses waiting on the VNC connection, so keystrokes can reach the node out of order and the escape sequence state (buffer, inputcontext, modkeys) is mutated by more than one task at a time. With the first keystroke relaying slowly, typing abcdef arrives as bcdefa. Those tasks were also unreferenced, which asyncio documents as collectable while still pending, so a keypress could be dropped. Queue the bytes in the reader callback and process them from one long-lived task instead. Keep a reference to the watch_input task as well, since collecting that one takes the whole input handler with it.