Skip to content

fix(amber): keep the failing worker when an error crosses ControlError - #9015

Open
sshiv012 wants to merge 7 commits into
apache:mainfrom
sshiv012:sshiv012/tex-86-control-error-worker
Open

sshiv012 wants to merge 7 commits into
apache:mainfrom
sshiv012:sshiv012/tex-86-control-error-worker

Conversation

@sshiv012

@sshiv012 sshiv012 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

#8668 tags a failed worker RPC with the worker it targeted (WorkflowRuntimeException with relatedWorkerId), so the surfaced error can point at that worker. But the worker is dropped one hop later: the coordinator returns the error to the web service as a ControlError, which has no field for it, and ErrorUtils.reconstructThrowable rebuilds a plain Throwable. WorkflowService's error handler then finds no worker and records the error as "unknown operator".

You can see this with a Python UDF that fails while starting (e.g. the default template, which has no class). The coordinator log shows WorkflowRuntimeException … Worker:WF23-PythonUDFV2-operator-udfdemo-main-0, but the UI gets operatorId: "unknown operator". So clicking the failed UDF shows only an empty Console and no error.

This PR carries the worker the rest of the way:

  • ControlError gets an optional relatedWorkerId (core.ActorVirtualIdentity).
  • mkControlError fills it from a WorkflowRuntimeException.
  • reconstructThrowable rebuilds a WorkflowRuntimeException with that worker when the field is set, so WorkflowService maps the error to the failing operator.

Errors without a worker are unchanged.

Any related issues, documentation, discussions?

Follow-up to #8668 (issue #8667). Part of #8736. With this, #8771 no longer needs a frontend workaround to show a failed UDF's startup error when the UDF is clicked.

How was this PR tested?

  • New specs in ErrorUtilsSpec:
    • mkControlError carries the worker of a WorkflowRuntimeException, and leaves it empty otherwise;
    • reconstructThrowable rebuilds a WorkflowRuntimeException with the worker, message and cause;
    • the rebuilt error maps to the right operator id via getOperatorFromActorIdOpt;
    • errors without a worker still rebuild a plain Throwable.
  • The two existing specs that build a ControlError directly pass the new field (None).
  • New e2e test in DataProcessingSpec: a source feeding a Java UDF that doesn't compile. The UDF is in the first region, so its error comes back as the reply to startWorkflow, through ControlError. The test expects a WorkflowRuntimeException naming the UDF worker. It fails on main and passes with this PR.
sbt "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.e2e.DataProcessingSpec -- -z \"fails to initialize\""
sbt "WorkflowExecutionService/testOnly org.apache.texera.amber.error.ErrorUtilsSpec org.apache.texera.amber.engine.architecture.scheduling.RegionExecutionManagerSpec org.apache.texera.amber.engine.architecture.scheduling.WorkflowExecutionManagerSpec"
sbt "WorkflowExecutionService/scalafmtCheck" "WorkflowExecutionService/Test/scalafmtCheck" "WorkflowExecutionService/scalafixAll --check"
bash bin/python-proto-gen.sh && cd amber && pytest -m "not integration"

End to end, on a local Texera built from current main plus this PR and #8771 (which no longer has a frontend filter), I ran a Python UDF that fails while starting:

operatorId the UI receives Clicking the failed UDF
main "unknown operator" (workerId empty) only an empty Console
this PR "PythonUDFV2-operator-udfdemo" (workerId Worker:WF23-PythonUDFV2-operator-udfdemo-main-0) a Static Error tab next to the Console, with the error

The message also loses its java.lang.Throwable: prefix, since the rebuilt WorkflowRuntimeException prints just its message.

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

Generated-by: Claude Code (Claude Opus 5.5)

apache#8668 tags a failed worker RPC with the worker (WorkflowRuntimeException
with relatedWorkerId), but ControlError had no field for it. When the
coordinator returned the error to the web service, reconstructThrowable
rebuilt a plain Throwable, so WorkflowService recorded "unknown
operator" and the UI could not show the error under the failed
operator (e.g. a Python UDF that fails while starting).

- Add relatedWorkerId to ControlError.
- mkControlError fills it from a WorkflowRuntimeException.
- reconstructThrowable rebuilds a WorkflowRuntimeException when it is
  set, so the worker reaches WorkflowService's error handler.

Co-Authored-By: Claude Opus 5.5 <[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 Oct 16, 2026
@github-actions
github-actions Bot requested a review from mengw15 October 16, 2026 22:30
@github-actions

github-actions Bot commented Oct 16, 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: @eugenegujing, @VuMartin, @aglinxinyuan
    You can notify them by mentioning @eugenegujing, @VuMartin, @aglinxinyuan in a comment.

@github-actions
github-actions Bot requested a review from xuang7 October 16, 2026 22:30
@github-actions

github-actions Bot commented Oct 16, 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 Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

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

Compared against main 89a492f 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 414 0.253 22,972/28,745/28,745 us 🔴 +18.3% / 🔴 +127.0%
🔴 bs=100 sw=10 sl=64 870 0.531 114,174/132,501/132,501 us 🔴 +11.1% / 🔴 +53.5%
⚪ bs=1000 sw=10 sl=64 972 0.593 1,028,589/1,070,943/1,070,943 us ⚪ within ±5% / 🔴 +32.8%
Baseline details

Latest main 89a492f from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 414 tuples/sec 467 tuples/sec 993.83 tuples/sec -11.3% -58.3%
bs=10 sw=10 sl=64 MB/s 0.253 MB/s 0.285 MB/s 0.607 MB/s -11.2% -58.3%
bs=10 sw=10 sl=64 p50 22,972 us 19,425 us 10,119 us +18.3% +127.0%
bs=10 sw=10 sl=64 p95 28,745 us 30,133 us 13,394 us -4.6% +114.6%
bs=10 sw=10 sl=64 p99 28,745 us 30,133 us 16,114 us -4.6% +78.4%
bs=100 sw=10 sl=64 throughput 870 tuples/sec 904 tuples/sec 1,327 tuples/sec -3.8% -34.4%
bs=100 sw=10 sl=64 MB/s 0.531 MB/s 0.552 MB/s 0.81 MB/s -3.8% -34.4%
bs=100 sw=10 sl=64 p50 114,174 us 111,371 us 79,097 us +2.5% +44.3%
bs=100 sw=10 sl=64 p95 132,501 us 119,220 us 86,335 us +11.1% +53.5%
bs=100 sw=10 sl=64 p99 132,501 us 119,220 us 94,338 us +11.1% +40.5%
bs=1000 sw=10 sl=64 throughput 972 tuples/sec 980 tuples/sec 1,363 tuples/sec -0.8% -28.7%
bs=1000 sw=10 sl=64 MB/s 0.593 MB/s 0.598 MB/s 0.832 MB/s -0.8% -28.7%
bs=1000 sw=10 sl=64 p50 1,028,589 us 1,009,282 us 774,633 us +1.9% +32.8%
bs=1000 sw=10 sl=64 p95 1,070,943 us 1,110,210 us 814,584 us -3.5% +31.5%
bs=1000 sw=10 sl=64 p99 1,070,943 us 1,110,210 us 858,914 us -3.5% +24.7%
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,483.30,200,128000,414,0.253,22972.16,28745.18,28745.18
1,100,10,64,20,2298.10,2000,1280000,870,0.531,114174.00,132500.76,132500.76
2,1000,10,64,20,20583.76,20000,12800000,972,0.593,1028588.71,1070943.14,1070943.14

@codecov-commenter

codecov-commenter commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.68%. Comparing base (89a492f) to head (c206455).

Files with missing lines Patch % Lines
...ala/org/apache/texera/amber/error/ErrorUtils.scala 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9015      +/-   ##
============================================
- Coverage     91.69%   91.68%   -0.01%     
- Complexity     5125     5126       +1     
============================================
  Files          1305     1305              
  Lines         58214    58159      -55     
  Branches       7594     7585       -9     
============================================
- Hits          53377    53322      -55     
  Misses         2931     2931              
  Partials       1906     1906              
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø) Carriedforward from 607a96c
agent-service 99.56% <ø> (ø) Carriedforward from 607a96c
amber 85.79% <87.50%> (+<0.01%) ⬆️
computing-unit-managing-service 63.83% <ø> (ø) Carriedforward from 607a96c
config-service 87.50% <ø> (ø) Carriedforward from 607a96c
file-service 82.16% <ø> (ø) Carriedforward from 607a96c
frontend 96.43% <ø> (-0.01%) ⬇️ Carriedforward from 607a96c
notebook-migration-service 83.77% <ø> (ø) Carriedforward from 607a96c
pyamber 98.38% <ø> (ø) Carriedforward from 607a96c
result-service 86.48% <ø> (ø) Carriedforward from 607a96c
workflow-compiling-service 80.90% <ø> (ø) Carriedforward from 607a96c

*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

sshiv012 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

When a Python UDF fails while starting, its error loses track of which operator failed on the way back to the UI, so it gets recorded as "unknown operator" and clicking the failed UDF shows an empty Console. This PR carries the failing worker through ControlError so the error lands on the right operator, and since v1.2 already has #8668 but not this fix, v1.2 and v1.3 users would hit the same confusing empty Console. @mengw15 @yangzhang75 please check if this needs to be backported (it is a small fix).

@mengw15 mengw15 removed the release/v1.3 back porting to release/v1.3 label Nov 9, 2026
@xuang7

xuang7 commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Removing release/v1.2: diagnostics only, and it changes the control protocol.

@xuang7 xuang7 removed the release/v1.2 back porting to release/v1.2 label Nov 16, 2026
@sshiv012

Copy link
Copy Markdown
Contributor Author

/request-review @Xiao-zhen-Liu

@Xiao-zhen-Liu Xiao-zhen-Liu 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.

Looks good to approve. Carrying relatedWorkerId on ControlError and rebuilding a WorkflowRuntimeException in reconstructThrowable preserves the failing worker when a first-region launch failure returns through startWorkflow, so WorkflowService attributes it to the failing operator instead of "unknown operator" and drops the extra java.lang.Throwable: prefix. I traced the path between worker, coordinator, and web service, checked that Python worker replies stay unchanged, and ran the four unit specs (56 tests), both DataProcessingSpec initialization tests (2 tests), and scalafmtCheck at head b2e14c44e7, all passing. Three non-blocking nits inline.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants