The GitHub Actions job "Backport Approval Check" on 
texera.git/gh-readonly-queue/main/pr-7122-f863ad26ddb3083bf2cc7e4105255e1010a8bbf0
 has succeeded.
Run started by GitHub user Xiao-zhen-Liu (triggered by Xiao-zhen-Liu).

Head commit for run:
6597c1b2cbb446da4cae4c8b6bbc0dafcf010232 / Martin Vu 
<[email protected]>
fix(amber): prevent region termination retry hang (#7122)

### What changes were proposed in this PR?

This PR fixes a region termination hang caused by unresponsive
`EndWorker` RPC calls.

Previously, `Future.collect(endWorkerRequests)` could wait forever if a
worker never responded. This prevented the termination retry mechanism
from running because the failure was never propagated, causing the
workflow to silently stall.

This change adds a 6s timeout around each termination attempt (5s
gracefulStop + 1s drain allowance) so stuck EndWorker and gracefulStop
operations fail and trigger the existing retry budget.

Cleanup of actor references and control channels is now delayed until
graceful termination succeeds and is performed on the coordinator actor
thread via a CleanupWorkerChannels message. The termination future
awaits the cleanup Promise, ensuring the channels are removed before
termination is considered complete.

**Before:** gracefulStop timeout → silent hang forever.
<img width="1327" height="619" alt="Screenshot 2026-07-29 at 1 26 05 AM"
src="https://github.com/user-attachments/assets/e5ca9a61-057a-4533-a79f-94ce83fedd2f";
/>

**After:** timeout → 4 attempts total → error.
<img width="1338" height="359" alt="Screenshot 2026-07-29 at 11 21
16 PM"
src="https://github.com/user-attachments/assets/1d299430-fdd9-42bd-8268-3248f7fcca25";
/>

### Any related issues, documentation, discussions?

Fixes #6920

### How was this PR tested?


- **Unit test added:** `"retry EndWorker when the termination timeout
expires"` in `RegionExecutionManagerSpec.scala` verifies that a
non‑responding `EndWorker` triggers a timeout and retry.
- **Existing tests updated:** backoff tests now use
`terminationTimeoutMs = Long.MaxValue` to isolate the retry logic.
- **Manual verification:** Simulated slow worker shutdown (> 5s delay).
Confirmed retry loop executes all 4 attempts and error fires with stuck
workers listed. No silent hang.
- Ran the `RegionExecutionManagerSpec` test suite locally — all tests
pass.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: ChatGPT (5.5-mini)

---------

Signed-off-by: Martin Vu <[email protected]>
Co-authored-by: Claude Sonnet 5 <[email protected]>

Report URL: https://github.com/apache/texera/actions/runs/43823307342

With regards,
GitHub Actions via GitBox

Reply via email to