This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch 
gh-readonly-queue/release/v1.2/pr-8063-51d8ff2d98ec35c412fa175bb4445a0f651b0542
in repository https://gitbox.apache.org/repos/asf/texera.git

commit 549b2db79379bcd2b0399657d3f1c61226a314d2
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Sep 19 19:09:39 2026 +0000

    fix(WorkflowExecutionService, v1.2): shutdown console writer thread on 
unsubscribe (#8063)
    
    ### What changes were proposed in this PR?
    
    Automated backport of #7914 to `release/v1.2`.
    
    Source: bdc6d2a90eb1415014a4f705b7bb7cca31bb9688 ยท [automation
    run](https://github.com/apache/texera/actions/runs/33140232474)
    
    ### Any related issues, documentation, discussions?
    
    Backport of #7914. Originally linked #7455.
    
    ### How was this PR tested?
    
    Release-branch CI runs on this branch once the conflicts are resolved
    and this PR is marked ready for review.
    
    ### Was this PR authored or co-authored using generative AI tooling?
    
    No.
    
    Co-authored-by: Martin Vu <[email protected]>
---
 .../web/service/ExecutionConsoleService.scala      | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git 
a/amber/src/main/scala/org/apache/texera/web/service/ExecutionConsoleService.scala
 
b/amber/src/main/scala/org/apache/texera/web/service/ExecutionConsoleService.scala
index 1678494e93..64c664bcb4 100644
--- 
a/amber/src/main/scala/org/apache/texera/web/service/ExecutionConsoleService.scala
+++ 
b/amber/src/main/scala/org/apache/texera/web/service/ExecutionConsoleService.scala
@@ -216,6 +216,31 @@ class ExecutionConsoleService(
     }
   )
 
+  override def unsubscribeAll(): Unit = {
+    consoleMessageOpIdToWriterMap.values.foreach { writer =>
+      try {
+        writer.close()
+      } catch {
+        case e: Exception =>
+          logger.error("Failed to close console message writer during 
unsubscribeAll", e)
+      }
+    }
+    consoleMessageOpIdToWriterMap.clear()
+
+    super.unsubscribeAll()
+
+    consoleWriterThread.shutdown()
+    try {
+      if (!consoleWriterThread.awaitTermination(5, 
java.util.concurrent.TimeUnit.SECONDS)) {
+        consoleWriterThread.shutdownNow()
+      }
+    } catch {
+      case _: InterruptedException =>
+        consoleWriterThread.shutdownNow()
+        Thread.currentThread().interrupt()
+    }
+  }
+
   /**
     * Processes a console message for display, performing truncation if needed.
     * This method uses the shared implementation in ConsoleMessageProcessor.

Reply via email to