Skip to content

fix(WorkflowExecutionService, v1.2): shutdown console writer thread on unsubscribe - #8063

Draft
github-actions[bot] wants to merge 1 commit into
release/v1.2from
backport/7914-shutdown-console-writer-thread-on-unsubs-v1.2
Draft

fix(WorkflowExecutionService, v1.2): shutdown console writer thread on unsubscribe#8063
github-actions[bot] wants to merge 1 commit into
release/v1.2from
backport/7914-shutdown-console-writer-thread-on-unsubs-v1.2

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Automated backport of #7914 to release/v1.2.

Source: bdc6d2a · automation run

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.

…bscribe (#7914)

### What changes were proposed in this PR?

Fixes a console writer thread leak in `ExecutionConsoleService`.

The console writer executor was not being shut down when an execution
service was unsubscribed. This could leave `texera-console-writer`
threads alive after workflow execution finished.

Before:
<img width="1240" height="60" alt="Screenshot 2026-08-23 at 11 40 04 PM"
src="https://github.com/user-attachments/assets/d199f3c0-a463-4645-addf-a5dc2ee456d8"
/>

After:
<img width="1348" height="48" alt="Screenshot 2026-08-23 at 6 40 25 PM"
src="https://github.com/user-attachments/assets/a2e0c9bc-607f-451f-bccb-ec4ea4315a96"
/>

<img width="1348" height="60" alt="Screenshot 2026-08-23 at 6 41 53 PM"
src="https://github.com/user-attachments/assets/3d7742ef-db7a-4790-a43d-d8b5bfa69d58"
/>
<img width="1348" height="60" alt="Screenshot 2026-08-23 at 6 42 18 PM"
src="https://github.com/user-attachments/assets/c2e7a6d6-e516-4dd1-8ed9-7d6cccf22f1f"
/>

<img width="1348" height="60" alt="Screenshot 2026-08-23 at 6 42 42 PM"
src="https://github.com/user-attachments/assets/084bed9e-1338-4e27-9563-ad22708d75aa"
/>
<img width="1348" height="60" alt="Screenshot 2026-08-23 at 6 42 55 PM"
src="https://github.com/user-attachments/assets/ee11bcca-35fa-453e-91e2-8f3e06065c1d"
/>

This PR:
- Shuts down the console writer executor during `unsubscribeAll()`.
- Waits for termination and falls back to `shutdownNow()` if necessary.
- Closes active console message writers and clears the writer map.
- Adds a test verifying the console writer executor is shut down and
terminated.

### Any related issues, documentation, discussions?

Fixes #7455

### How was this PR tested?

Ran:
```bash
sbt "project WorkflowExecutionService" "testOnly *ExecutionConsoleServiceSpec -- -z unsubscribeAll"
```
Manual testing:

Ran workflows multiple times and checked the console writer threads
with:
```bash
jcmd 57436 Thread.print | grep "texera-console-writer"
```
```bash
jcmd 67548 Thread.print | grep "texera-console-writer"
```
Verified that the console writer threads are terminated after workflow
execution completes and unsubscribeAll() is called.

### Was this PR authored or co-authored using generative AI tooling?
Generated-by: ChatGPT (5.5 mini)

(backported from commit bdc6d2a)
@github-actions

Copy link
Copy Markdown
Contributor Author

The cherry-pick conflicted and was committed with conflict markers. Resolve the conflicts on this branch, then mark this PR ready for review.

Conflicting files:

  • amber/src/test/scala/org/apache/texera/web/service/ExecutionConsoleServiceSpec.scala

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant