kunwp1 opened a new issue, #9641: URL: https://github.com/apache/texera/issues/9641
### What happened? The last console messages of an execution can be lost from the stored console output, the same race #9627 describes for runtime statistics. I expected every console message an operator printed to be committed when the execution ends. Root cause. In `ExecutionConsoleService`, `addConsoleMessage` only queues each write on `consoleWriterThread` (`ExecutionConsoleService.scala:294-301`), but the terminal `ExecutionStateUpdate` callback and `unsubscribeAll` close the writers directly on the calling thread (`ExecutionConsoleService.scala:214-219` and `224-231`). A message printed just before the run ends can still be queued when `close()` flushes and commits, so it lands in the writer's buffer after the flush and is never committed. When the two overlap, `putOne` and the flush touch the non-thread-safe buffer from two threads. ``` Before: last message -> queued on writer thread | terminal state -> close() now -> commit -> queued message buffered, never committed After: last message -> queued on writer thread | terminal state -> close() queued behind it -> message committed ``` ### How to reproduce? Found by reading the code while fixing #9627 (PR #9628), not seen in a run yet. In `ExecutionConsoleServiceSpec`, hold `consoleWriterThread`, add a console message, fire `ExecutionStateUpdate(COMPLETED)`, release the thread, and read the console messages table: the message is missing. ### Version/Branch 1.4.0-incubating-SNAPSHOT (main) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
