Skip to content

fix(upstream): Request body limit is not a network error#6149

Open
jjbayer wants to merge 4 commits into
masterfrom
fix/limit-not-network-error
Open

fix(upstream): Request body limit is not a network error#6149
jjbayer wants to merge 4 commits into
masterfrom
fix/limit-not-network-error

Conversation

@jjbayer

@jjbayer jjbayer commented Jun 29, 2026

Copy link
Copy Markdown
Member

When the request body is a stream, errors can occur during sending that relate to the client / request, not the server. There's probably more than this one but it's unclear to me how to filter them.

This introduces a third request outcome variant that does not get retried, but also does not influence connection outage handling.

With help from Codex.

@jjbayer jjbayer marked this pull request as ready for review June 29, 2026 13:50
@jjbayer jjbayer requested a review from a team as a code owner June 29, 2026 13:50
Comment thread relay-server/src/services/upstream.rs
Comment thread relay-server/src/services/upstream.rs Outdated
return false;
}

// TODO: there's probably more exceptions to this rule.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Imo todo's should link to issues and actually be something we fix, maybe better as a Note:?

@jjbayer jjbayer enabled auto-merge June 30, 2026 10:40

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7088763. Configure here.

Comment thread relay-server/src/services/upstream.rs
@jjbayer jjbayer disabled auto-merge June 30, 2026 10:42
Comment on lines +1242 to +1243
/// The request failed without indicating the state of the upstream connection.
Failed,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We need three states now, because in case of a client-side request error like the length limit error, we want to skip retries but we also do not want to trigger a network outage, nor mark a network outage as resolved.

@jjbayer jjbayer requested a review from Dav1dde June 30, 2026 11:55
Comment thread relay-conventions/sentry-conventions
self.conn.reset_error();
self.queue.trigger_retries();
}
RequestOutcome::Failed => {}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why does this skip notify_error?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The doc comment on notify error says:

/// Notifies the monitor of a request that resulted in a network error.

A local request failure does not contain any information about the connection (e.g. a length limit error should not initiate a reconnection attempt).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess I don't know enough about the upstream whether we need to actually establish a new connection using that mechanism or if everything is fine. My intuition is, that we will have to actually make a new http connection and can't re-use the original one, but maybe reqwest already deals with that for us.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fair point, but notify_error wouldn't close the connection either. It just starts a grace period after which a reconnect is triggered.

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.

2 participants