aglinxinyuan opened a new issue, #7455:
URL: https://github.com/apache/texera/issues/7455

   ### Describe the bug
   
   `ExecutionConsoleService` creates a single-thread executor per instance and 
never shuts it down.
   
   ```scala
   // line 141
   private val consoleWriterThread: ExecutorService = 
Executors.newSingleThreadExecutor()
   ```
   
   `grep -n 'shutdown' ExecutionConsoleService.scala` returns nothing. 
`Executors.newSingleThreadExecutor()` uses the default thread factory, which 
creates **non-daemon** threads, so each one keeps a live reference and prevents 
the pool from being collected for the lifetime of the JVM.
   
   One `ExecutionConsoleService` is constructed per workflow execution, so a 
long-running server accumulates one idle non-daemon thread per execution.
   
   ### To Reproduce
   
   Run several workflow executions against a single server and inspect the 
thread dump (`jcmd <pid> Thread.print`). The `pool-N-thread-1` entries 
accumulate — one per execution — and none is reclaimed after the execution 
finishes.
   
   ### Expected behavior
   
   The executor should be shut down when the service is disposed. 
`ExecutionConsoleService` extends `SubscriptionManager`, so the natural place 
is alongside the existing subscription teardown — 
`consoleWriterThread.shutdown()` when the service is unsubscribed, and ideally 
`awaitTermination` so a queued `storeRuntimeStatistics` write is not dropped 
mid-flight.
   
   Making the thread factory produce daemon threads would stop it holding the 
JVM open, but would not stop the accumulation.
   
   ### Additional context
   
   Found while adding coverage for this class (the console diff handler and 
debug-command routing). The tests do not exercise the writer path — it is 
Iceberg-bound — so this was found by reading rather than by a failure.
   


-- 
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]

Reply via email to