Skip to content

Ensure that we don't send massive error message over gRPC - #1108

Merged
QnJ1c2kNCg merged 1 commit into
ArroyoSystems:masterfrom
QnJ1c2kNCg:broy/cap-grpc-size
Jul 21, 2026
Merged

Ensure that we don't send massive error message over gRPC#1108
QnJ1c2kNCg merged 1 commit into
ArroyoSystems:masterfrom
QnJ1c2kNCg:broy/cap-grpc-size

Conversation

@QnJ1c2kNCg

@QnJ1c2kNCg QnJ1c2kNCg commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

The gRPC servers are configured with a max size of 4MB, this patch adds more resiliency for potentially large error message that would bust the gRPC message size limit.


Open in Devin Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Open in Devin Review

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Oversized non-fatal error messages can still exceed the gRPC limit and fail the job

The non-fatal error message and details are sent to the controller untruncated (error: message/details at crates/arroyo-worker/src/lib.rs:605-608), unlike the fatal path which was capped, so a large error can still blow past the 4MB gRPC message limit.
Impact: A single oversized non-fatal error (e.g. from bad input data) makes the RPC fail, which cancels the worker and takes the whole job down — the exact scenario this change was meant to prevent.

Why the non-fatal path is also at risk

The fatal path at crates/arroyo-worker/src/lib.rs:579-586 now wraps both error and details in maybe_truncate(..., MAX_TASK_ERROR_FIELD_BYTES). The NonfatalErrorReq built at crates/arroyo-worker/src/lib.rs:597-610 assigns error: message and details directly with no size guard. The details value originates from deserialization/bad-data handling (crates/arroyo-operator/src/context.rs:389), which can embed raw offending record contents and thus be arbitrarily large. When such a message exceeds the 4MB limit, send_control_rpc! returns an error and cancel_token.cancel() is invoked (crates/arroyo-worker/src/lib.rs:637-643), terminating the job.

(Refers to lines 605-608)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

The gRPC servers are configured with a max size of 4MB,
this patch adds more resiliency for potentially large error
message that would bust the gRPC message size limit.
@QnJ1c2kNCg
QnJ1c2kNCg force-pushed the broy/cap-grpc-size branch from f551334 to 854efc9 Compare July 18, 2026 02:31
@QnJ1c2kNCg
QnJ1c2kNCg requested a review from mwylde July 20, 2026 19:27
"Truncated oversized String from {} bytes to {} bytes: {}",
original_bytes,
value.len(),
value

@cmackenzie1 cmackenzie1 Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If I read this right, these logs will be ~64kB of unknown data. Is that something we want to include in the log?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I decided to log them as they can be useful to understand the root cause. In theory (🤞), we shouldn't really have this truncation happen often, if at all.

@QnJ1c2kNCg
QnJ1c2kNCg merged commit 235ccf8 into ArroyoSystems:master Jul 21, 2026
4 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.

3 participants