kunwp1 opened a new issue, #9627: URL: https://github.com/apache/texera/issues/9627
### What happened? The last runtime statistics snapshot of an execution can be lost, so Runtime Statistics and the heat-map restore show each operator's numbers from one polling interval before the end instead of its final counts and times. I expected the final snapshot the engine reports to be in the persisted statistics. Root cause. In `ExecutionStatsService`, the `RuntimeStatisticsPersist` callback only queues the write on `metricsPersistThread`, but the terminal `ExecutionStateUpdate` callback calls `runtimeStatsWriter.close()` directly on the callback thread. The engine sends the final `RuntimeStatisticsPersist` just before the terminal state, so `close()` can flush and commit before that snapshot is written. The snapshot then lands in the writer's buffer after the flush and is never committed. When the two do overlap, `putOne` and `flushBuffer` touch the non-thread-safe buffer from two threads. The single-thread executor is also never shut down, so every execution leaves an idle thread behind. ``` Before: final persist -> queued on persist thread | terminal state -> close() now -> commit -> queued snapshot buffered, never committed After: final persist -> queued on persist thread | terminal state -> close() queued behind it -> snapshot committed -> executor shut down ``` ### How to reproduce? In `ExecutionStatsServiceSpec`, hold the persist thread, fire `RuntimeStatisticsPersist` and then `ExecutionStateUpdate(COMPLETED)`, release the thread, and read the statistics table: it has no rows. The existing persistence tests wait for the persist thread before firing the terminal state, which is why they pass. ### Version/Branch 1.4.0-incubating-SNAPSHOT (main) ### Commit Hash (Optional) _No response_ ### What browsers are you seeing the problem on? _No response_ ### Relevant log output ```shell ``` -- 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]
