fix: oversize payload causing universal instrumentation failures#1067
Merged
joeyzhao2018 merged 6 commits intomainfrom Mar 9, 2026
Merged
fix: oversize payload causing universal instrumentation failures#1067joeyzhao2018 merged 6 commits intomainfrom
joeyzhao2018 merged 6 commits intomainfrom
Conversation
When the response payload exceeds the 6MB DefaultBodyLimit, extract_request_body fails inside the spawned task, causing an early return that skips universal_instrumentation_end entirely — dropping trace context, span finalization, and status code extraction. Fix by splitting the request into parts upfront (preserving headers) and falling back to an empty body when buffering fails, so processing always continues with a degraded payload. Update the test to verify the graceful degradation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
duncanista
reviewed
Mar 9, 2026
|
|
||
| use crate::{ | ||
| http::{extract_request_body, headers_to_map}, | ||
| http::{extract_request_body_or_empty, headers_to_map}, |
Contributor
There was a problem hiding this comment.
So if you're using extract_request_body_or_empty, what's going on with extract_request_body? Is that ever used again? Do we need to update this new behavior in previous usages or?
Contributor
Author
There was a problem hiding this comment.
there are a few other usages for extract_request_body
I actually don't have enough background knowledge to say if those cases can follow the same pattern...Do you think we should make all of them just log the error and accept empty body?
Contributor
There was a problem hiding this comment.
I see, fair enough, let's keep it as is for this one and let the other ones handle it as they expect it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of passing the whole Request into the spawned task and calling extract_request_body (which consumes the request and early-returns on failure), the fix:
dropped
The FromRequest import was added to the module-level axum imports to support calling Bytes::from_request directly.