Skip to content

fix: Raise the exceptions of the client callbacks in the caller of a distributed batched_run - #1903

Merged
polvalente merged 1 commit into
elixir-nx:mainfrom
georgeguimaraes:distributed-raise
Nov 20, 2026
Merged

polvalente merged 1 commit into
elixir-nx:mainfrom
georgeguimaraes:distributed-raise

Conversation

@georgeguimaraes

Copy link
Copy Markdown
Member

When client_preprocessing or client_postprocessing raises in a distributed batched_run, the remote process crashes and the caller exits. A local call raises the exception. So a caller must rescue the exception for a local serving and catch an exit for a remote serving, for example to reply to bad input.

This change rescues the exception on the remote node and sends it with its stacktrace in the exit reason. The caller raises it again. This also applies when the remote node enumerates a stream of client_postprocessing: the stream raises the exception in the caller.

Exits of the serving, such as :noproc and a crash of the serving process, do not change.

Both tests fail on main with an exit.

…ibuted batched_run

A distributed call turned an exception of the client preprocessing or postprocessing on the remote node into an exit in the caller. A local call raises the exception. So a caller had to rescue an exception for a local serving and catch an exit for a remote serving.

Now the remote node sends the exception and its stacktrace, and the caller raises them again. This also applies to an exception while the remote node enumerates a stream of the client postprocessing.
@georgeguimaraes

Copy link
Copy Markdown
Member Author

The 2 EXLA jobs fail only on the doctest of Nx.acosh/1 with f64 (1.3169578969248166 against 1.3169578969248168). This doctest also fails on other open PRs. Commit 0e10725 in #1899 fixes it.

@polvalente
polvalente merged commit 902ee0f into elixir-nx:main Nov 20, 2026
7 of 9 checks passed
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.

2 participants