Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server): accept minidumps in a gzip container #4029

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

supervacuus
Copy link
Contributor

During the work on native assigned documentation issues, the topic of compressing minidumps when uploading them via curl directly to the minidump endpoint came up.

This is my attempt at documenting the current process: https://github.com/getsentry/sentry-docs/pull/11304/files.

Uploading a compressed minidump without meta-data is relatively straightforward. You use a gzipped minidump as the sole POST content, provide the minidump content type, and define it as gzip-encoded. Axum transparently decodes the minidump before they even reach the relay endpoint, and you can process them if you are oblivious to the encoding.

Unfortunately, due to the way encoding can't be supplied per multipart field (at least not RFC conforming) if a user wanted to supply meta-data with the minidump, they would have to construct the entire multipart content manually, which is error-prone, compress that whole body, and send it again as a single data request.

Curl doesn't provide any convenience for gzip encoding arbitrary POST content.

This simple change in Relay would allow users to make no change between their curl requests (they could use simple curl field parameters as explained in docs) besides uploading a gzipped minidump in place of a plain one.

Let me know if this would be an acceptable change compared to adding the documentation, which describes a severely manual and, thus, error-prone process.

Copy link
Member

@jan-auer jan-auer left a comment

Choose a reason for hiding this comment

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

Thanks, this has been a long requested feature!

Do you think it would make sense to support additional compression methods such as zstd as well?

@@ -97,7 +120,11 @@ async fn extract_multipart(
minidump_item.set_payload(ContentType::Minidump, embedded);
}

validate_minidump(&minidump_item.payload())?;
if validate_minidump(&minidump_item.payload()).is_err() {
Copy link
Member

Choose a reason for hiding this comment

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

Small suggestion: Similar to how we check for embedded minidumps, could we invert the logic slightly to fully separate concerns? Right now, validate_gzip_minidump fails with an error "invalid minidump" where actually it tests for a gzip header.

I'm thinking about control flow like this:

  1. Check for a compression header
    1. If there is compression, then try to decompress and propagate all errors
    2. Replace the payload bytes with the decompressed bytes
  2. Now check the minidump header once.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, of course, this makes sense. I was only prepping a PoC to check for basic warning signs and whether you want automatic detection/decoding in the endpoint. I am also unhappy with the gzip being the fallback to the typical case 😅.

@supervacuus
Copy link
Contributor Author

Thanks, this has been a long requested feature!

Even better.

Do you think it would make sense to support additional compression methods such as zstd as well?

Yes, definitely. I guess xz and, to a lesser degree, bzip2 could also be interesting. I think most of those are already included as trusted implementations in Relay, right?

@supervacuus
Copy link
Contributor Author

Just so you know, I am working on an escalating Android issue and will revisit this when I have more time.

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