apache / apache/texera

sync-execution timeout misclassified as "Error" instead of "Killed" (wrapped TimeoutException)

Open
#6,198 1 comment 0 reactions 1 assignee Claimed by @anthonychengit View on GitHub
Dominant language
Scala
Stars
314
Forks
187
Avg merge
1d 21h
Merged PRs (30d)
214

Description

### What happened?

The synchronous workflow-execution endpoint (`SyncExecutionResource`) is supposed to return state `"Killed"` with a `"Timeout after N seconds"` error — and call `killExecution` — when a run exceeds its `timeoutSeconds`. Instead, a genuine timeout is **misclassified as a generic `"Error"`** and the execution is **not killed**.

**Root cause.** The terminal wait is:

```scala
Observable.amb(...).firstOrError().timeout(timeoutSeconds, SECONDS).blockingGet()
```

`firstOrError()` yields a `Single`, and RxJava's `Single.blockingGet()` rethrows a failure via `ExceptionHelper.wrapOrThrow`, which **wraps the checked `java.util.concurrent.TimeoutException`** (thrown by `.timeout()`) **in a `RuntimeException`**. The catch clause matches on:

```scala
case _: java.util.concurrent.TimeoutException => // Killed
```

which never matches the wrapped exception, so control falls through to the generic `case e: Exception => // Error` branch.

**Expected:** a timeout is detected (by unwrapping the cause chain), reported as `state = "Killed"` with `"Timeout after N seconds"`, and the execution is killed.

### How to reproduce?

1. Submit a workflow to the sync-execution endpoint with a small `timeoutSeconds`.
2. Ensure no terminal signal (completion / console-error / target-results) arrives before the timeout elapses.
3. Observe the response: `state = "Error"` carrying the raw wrapped-exception message, instead of `state = "Killed"` / `"Timeout after N seconds"`; the execution is not killed.

### Version/Branch

1.3.0-incubating-SNAPSHOT (main)

### Commit Hash (Optional)

Present on `main`; the branch behavior is unchanged from the introduction of the `case _: TimeoutException` catch.

### Relevant log output

_n/a — the timeout is silently reclassified as a generic error._

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.