Skip to content

fix(amber): surface region launch failures instead of hanging - #8668

Merged
aicam merged 7 commits into
apache:mainfrom
sshiv012:sshiv012/surface-region-launch-failures
Oct 2, 2026
Merged

aicam merged 7 commits into
apache:mainfrom
sshiv012:sshiv012/surface-region-launch-failures

Conversation

@sshiv012

@sshiv012 sshiv012 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

A worker failing to initialize in a region's second (non-dependee) phase, e.g. a Python UDF after a HashJoin, used to leave the execution RUNNING forever with no error. See the issue for the full chain.

  • WorkflowExecutionManager.advanceRegionExecutions: keep the syncStatusAndTransitionRegionExecutionPhase() futures instead of dropping them in a foreach. The advance future now fails if any sync fails, so the existing .onFailure → FatalError in AdvanceRegionExecutionsHandler reports it. The rest of the method moved unchanged into advanceToNextRegions.
  • RegionExecutionManager: a failed launch RPC (initializeExecutor, assignPort, openExecutor, startWorker) is wrapped as WorkflowRuntimeException with the target worker ID, so the FatalError names the failing worker and operator (review feedback).
  • AsyncRPCClient.logControlReply: log the ControlError message, details and stack trace. It isn't a Throwable, so the logger silently dropped it.
Before After
UDF missing from pytexera import * after a join hangs, all 0 tuples, no error fails in ~1s with name 'UDFTableOperator' is not defined, attributed to the UDF worker
Log line received error from … received error from … (controlID: N): <message>

Behavior note: the future returned by advanceRegionExecutions now also waits on, and fails with, the syncs it triggers. AdvanceRegionExecutionsHandler doesn't wait on it. StartWorkflowHandler has no unfinished regions at start, so nothing changes there.

Any related issues, documentation, discussions?

Closes #8667

How was this PR tested?

Added tests. Each new failing-case test fails before the fix and passes after it.

  • WorkflowExecutionManagerSpec, 2 new tests: a region whose probe op has a dependee port, followed by a UDF op.
    • The UDF's initializeExecutor returns a ControlError → the advance fails with that message.
    • The UDF initializes fine → it is started.
  • DataProcessingSpec, 1 new e2e test on csv, csv → join → UDF: a Java UDF whose code doesn't compile, so the worker fails in initializeExecutor, the same step as a Python UDF with an import error.
    • Before the fix it times out after 1 min; after, it fails in ~0.5s, naming the UDF worker.
    • It uses a Java UDF because CI's amber job has no Python environment.
  • RegionExecutionManagerTestSupport: CoordinatorRpcProbe takes an optional initializeExecutorResponse.
sbt 'WorkflowExecutionService/testOnly org.apache.texera.amber.engine.architecture.scheduling.WorkflowExecutionManagerSpec'
sbt 'WorkflowExecutionService/testOnly org.apache.texera.amber.engine.e2e.DataProcessingSpec -- -z "fail, not hang"'

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

Generated-by: Claude Code (Claude Opus 5.5)

🤖 Generated with Claude Code

When a region has dependee input ports (e.g. a HashJoin probe), its
non-dependee operators are launched from a later advance round via
syncStatusAndTransitionRegionExecutionPhase(). advanceRegionExecutions
discarded those futures, so if a worker failed there (e.g. a Python UDF
whose code raises NameError at load time) the error was lost: no
FatalError reached the client, no operator in the region started, and
the execution stayed RUNNING forever.

- Keep the sync futures and fail the advance future if any fails, so
  AdvanceRegionExecutionsHandler reports a FatalError.
- Log ControlError contents in AsyncRPCClient; it is not a Throwable, so
  the logger silently dropped it.
- Tests: manager unit tests for a failing/succeeding second phase, and
  e2e csv->join->Python UDF tests, including a UDF missing
  `from pytexera import *`, which now fails in ~1s instead of timing out.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@Yicong-Huang Yicong-Huang added release/v1.3 back porting to release/v1.3 release/v1.2 back porting to release/v1.2 labels Sep 24, 2026
@github-actions
github-actions Bot requested review from mengw15 and xuang7 September 24, 2026 23:37
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. A release/* label nominates a backport target; the branch's release manager approving this PR is what sends the fix there. The required Backport Approvals check stays red until every label below is approved, so each manager either approves or removes their own label — which is why the labels left on a merged PR are exactly the branches it reached.

Release branch Analysis
🚫 release/v1.3 Label was removed earlier (opt-out); not re-added. Re-add it by hand if this fix should be backported here after all — the branch's release manager then has to approve before this PR can merge.
🚫 release/v1.2 Label was removed earlier (opt-out); not re-added. Re-add it by hand if this fix should be backported here after all — the branch's release manager then has to approve before this PR can merge.

Auto-label run.

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @Yicong-Huang, @aglinxinyuan, @aicam
    You can notify them by mentioning @Yicong-Huang, @aglinxinyuan, @aicam in a comment.

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 0 better · 🔴 3 worse · ⚪ 12 noise (<±5%) · 0 without baseline

Compared against main e5c8511 benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🔴 bs=10 sw=10 sl=64 395 0.241 25,105/30,794/30,794 us 🔴 +11.5% / 🔴 +123.6%
⚪ bs=100 sw=10 sl=64 791 0.483 124,882/150,923/150,923 us ⚪ within ±5% / 🔴 +56.3%
⚪ bs=1000 sw=10 sl=64 916 0.559 1,089,188/1,153,655/1,153,655 us ⚪ within ±5% / 🔴 -25.9%
Baseline details

Latest main e5c8511 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 395 tuples/sec 438 tuples/sec 935.16 tuples/sec -9.8% -57.8%
bs=10 sw=10 sl=64 MB/s 0.241 MB/s 0.267 MB/s 0.571 MB/s -9.7% -57.8%
bs=10 sw=10 sl=64 p50 25,105 us 22,511 us 11,225 us +11.5% +123.6%
bs=10 sw=10 sl=64 p95 30,794 us 31,881 us 13,984 us -3.4% +120.2%
bs=10 sw=10 sl=64 p99 30,794 us 31,881 us 17,158 us -3.4% +79.5%
bs=100 sw=10 sl=64 throughput 791 tuples/sec 824 tuples/sec 1,202 tuples/sec -4.0% -34.2%
bs=100 sw=10 sl=64 MB/s 0.483 MB/s 0.503 MB/s 0.734 MB/s -4.0% -34.2%
bs=100 sw=10 sl=64 p50 124,882 us 119,444 us 90,147 us +4.6% +38.5%
bs=100 sw=10 sl=64 p95 150,923 us 145,250 us 96,575 us +3.9% +56.3%
bs=100 sw=10 sl=64 p99 150,923 us 145,250 us 104,995 us +3.9% +43.7%
bs=1000 sw=10 sl=64 throughput 916 tuples/sec 925 tuples/sec 1,236 tuples/sec -1.0% -25.9%
bs=1000 sw=10 sl=64 MB/s 0.559 MB/s 0.564 MB/s 0.755 MB/s -0.9% -25.9%
bs=1000 sw=10 sl=64 p50 1,089,188 us 1,080,558 us 888,237 us +0.8% +22.6%
bs=1000 sw=10 sl=64 p95 1,153,655 us 1,170,219 us 927,592 us -1.4% +24.4%
bs=1000 sw=10 sl=64 p99 1,153,655 us 1,170,219 us 954,428 us -1.4% +20.9%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,506.66,200,128000,395,0.241,25104.68,30793.57,30793.57
1,100,10,64,20,2529.76,2000,1280000,791,0.483,124881.90,150922.83,150922.83
2,1000,10,64,20,21844.43,20000,12800000,916,0.559,1089187.64,1153654.63,1153654.63

@codecov-commenter

codecov-commenter commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.56%. Comparing base (e5c8511) to head (8480255).

Files with missing lines Patch % Lines
...chitecture/scheduling/RegionExecutionManager.scala 75.00% 0 Missing and 1 partial ⚠️
...exera/amber/engine/common/rpc/AsyncRPCClient.scala 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8668      +/-   ##
============================================
- Coverage     92.58%   92.56%   -0.02%     
- Complexity     4981     4984       +3     
============================================
  Files          1244     1245       +1     
  Lines         52933    52767     -166     
  Branches       6550     6523      -27     
============================================
- Hits          49006    48846     -160     
+ Misses         2295     2292       -3     
+ Partials       1632     1629       -3     
Flag Coverage Δ *Carryforward flag
access-control-service 77.38% <ø> (ø) Carriedforward from d102e26
agent-service 99.16% <ø> (ø) Carriedforward from d102e26
amber 88.07% <80.00%> (+0.01%) ⬆️
computing-unit-managing-service 60.41% <ø> (ø) Carriedforward from d102e26
config-service 87.37% <ø> (ø) Carriedforward from d102e26
file-service 81.53% <ø> (ø) Carriedforward from d102e26
frontend 96.54% <ø> (-0.02%) ⬇️ Carriedforward from d102e26
notebook-migration-service 83.73% <ø> (ø) Carriedforward from d102e26
pyamber 98.56% <ø> (+0.06%) ⬆️ Carriedforward from d102e26
workflow-compiling-service 74.09% <ø> (ø) Carriedforward from d102e26

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sshiv012

Copy link
Copy Markdown
Contributor Author

/request-review @aicam

@github-actions
github-actions Bot requested a review from aicam September 25, 2026 01:14
@xuang7

xuang7 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Removed backport label: not a regression (the behavior predates v1.2), the failure is visible rather than silent.

@xuang7 xuang7 removed release/v1.2 back porting to release/v1.2 release/v1.3 back porting to release/v1.3 labels Sep 25, 2026
@xuang7
xuang7 removed their request for review September 25, 2026 01:46
@mengw15
mengw15 removed their request for review September 25, 2026 03:41

@Ma77Ball Ma77Ball left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sshiv012 ty for the PR. Overall, this PR LGTM!

A minor nit is to consider carrying the failing worker ID into the surfaced FatalError found in AdvanceRegionExecutionsHandler.scala

Wrap the per-worker RPCs that launch a region (initializeExecutor,
assignPort, openExecutor, startWorker) so a failure becomes a
WorkflowRuntimeException carrying the target worker id. The existing
FatalError(err, err.relatedWorkerId) in AdvanceRegionExecutionsHandler
then reports it, and the UI can attribute the error to that operator.

Addresses review feedback on apache#8668.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@sshiv012

Copy link
Copy Markdown
Contributor Author

@Ma77Ball Thanks, good call. Done in 1d583d5.

The failure arrived as a plain Throwable (rebuilt from the worker's ControlError), so relatedWorkerId was always None. Now each per-worker RPC that launches a region (initializeExecutor, assignPort, openExecutor, startWorker) wraps a failure as WorkflowRuntimeException(msg, cause, Some(workerId)). The existing FatalError(err, err.relatedWorkerId) then carries the worker ID, and the UI can attribute the error to that operator.

The tests now assert the worker ID too, and they failed before this change:

  • unit: relatedWorkerId == Some(udfWorkerId)
  • e2e: the Python UDF's worker ID

architecture.* 770/770, and scalafix and scalafmt are clean.

sshiv012 pushed a commit to sshiv012/dknet-ai-public that referenced this pull request Sep 25, 2026
Wrap the per-worker RPCs that launch a region (initializeExecutor,
assignPort, openExecutor, startWorker) so a failure becomes a
WorkflowRuntimeException carrying the target worker id. The existing
FatalError(err, err.relatedWorkerId) in PortCompletedHandler then
reports it, and the UI can attribute the error to that operator.

Port of review feedback on apache/texera#8668.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@Ma77Ball

Copy link
Copy Markdown
Contributor

@sshiv012 there does appear to be a failing test in the DataProcessingSpec.scala. Please fix it before this can be merged.

The amber CI job has no Python environment, so the e2e tests that
started a real Python worker could not run there. Use a Java UDF whose
code does not compile instead: it fails in initializeExecutor exactly
like a Python UDF with an import error, with no external runtime. The
happy path stays covered by the existing join e2e test and the
WorkflowExecutionManagerSpec unit test.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@sshiv012

Copy link
Copy Markdown
Contributor Author

Fixed in d784f5d. The new e2e tests started a real Python worker, which passed locally but not in CI, because CI's amber job has no Python environment?? The test now uses a Java UDF that fails to compile at the same setup step, so it needs no Python.

@aicam
aicam enabled auto-merge October 2, 2026 20:33
@aicam
aicam added this pull request to the merge queue Oct 2, 2026
Merged via the queue into apache:main with commit 3ae15e6 Oct 2, 2026
23 checks passed
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Nov 7, 2026
… errors (apache#8771)

### What changes were proposed in this PR?

Two small hints in the workspace:

- **Kill button tooltip:** "Stop this run. A stopped run can't be
resumed." It was an icon-only button with no explanation.
- **Empty Result panel:** the heading now says why it is empty: "No
operator is selected." or "This operator has no results yet." With
nothing selected it also says "Click an operator to see its results. If
a run fails, its errors show here." It always adds "Errors an operator
hits while running show in that operator's Console." A failed run's
errors only appear in the Static Error tab when nothing is selected, and
errors during a run pause it and go to the operator's Console. Neither
hint shows while previewing a workflow version.

Before and after, with nothing selected (top) and an operator selected
(middle). The bottom row (a failed UDF showing its Static Error tab when
clicked) is no longer part of this PR: on main that error still arrives
as "unknown operator", because `ControlError` drops the worker that
apache#8668 attaches. That will be fixed in the backend in a separate PR.


<img width="1648" height="854" alt="texera-8771-before-after-v2"
src="https://github.com/user-attachments/assets/b1034c28-ce7d-4baf-b2f2-cfd935bc503e"
/>


The tooltip is a native `title`, which browsers don't draw in
screenshots. I checked it in the running app: hovering the red button
shows "Stop this run. A stopped run can't be resumed."

### Any related issues, documentation, discussions?

Part of apache#8736. Split out of apache#8737.

### How was this PR tested?

New specs in `result-panel.component.spec.ts` (nothing selected, an
operator selected, version preview) and `menu.component.spec.ts` (the
tooltip).

```
cd frontend
yarn test --include src/app/workspace/component/result-panel/result-panel.component.spec.ts --include src/app/workspace/component/menu/menu.component.spec.ts
yarn test
yarn format:ci
```

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

Generated-by: Claude Code (Claude Opus 5.5)

---------

Co-authored-by: suryaacharan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Execution hangs in RUNNING when a worker fails to initialize in a region's second phase

6 participants