You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
crashpad_handler DCHECKs (debug) and leaks zlib state (release) when a crash-report upload fails partway #2323
When a network write fails partway through a crash-report upload, GzipHTTPBodyStream (external/crashpad/util/net/http_body_gzip.cc) is destroyed before the stream finishes. Its destructor only DCHECKs that the stream finished, so:
in a debug build, crashpad_handler hits the DCHECK (0x80000003 breakpoint on Windows)
in a release build, the zlib deflate state is never freed, roughly 256 KB per failed upload
The code is upstream Crashpad and is unchanged on the getsentry branch of getsentry/crashpad. Upstream report, with the full analysis and a unit-test repro: https://issues.chromium.org/issues/587029408
Proposed fix: call deflateEnd() in the destructor when the stream is still operating, and ignore the expected Z_DATA_ERROR:
GzipHTTPBodyStream::~GzipHTTPBodyStream() {
// A failed or cancelled upload may destroy the body before reaching EOF.if (state_ == State::kOperating || state_ == State::kInputEOF) {
int zr = deflateEnd(z_stream_.get());
if (zr != Z_OK && zr != Z_DATA_ERROR) {
LOG(ERROR) << "deflateEnd: " << ZlibErrorString(zr);
}
}
}
We carry this as a local patch on 0.17.5. It would be good to have it in getsentry/crashpad, whether picked up from upstream or applied directly, so SDK users get it without patching.
When does the problem happen
During build
During run-time
When capturing a hard crash
The handler fails while uploading a report it already captured, not while capturing the crash.
Environment
OS: Windows 11, 64-bit. The libcurl transport (Linux, macOS) stops reading the body the same way, so those platforms should be affected too
Compiler: MSVC 14.51 toolset (Visual Studio 2026)
CMake version and config: sentry-native 0.17.5, SENTRY_BACKEND=crashpad, Debug for the DCHECK, Release for the leak
Steps To Reproduce
Start the crashpad backend with gzip uploads enabled (Crashpad's default)
Capture a crash so the handler uploads a report
Make the upload fail after the request has started, e.g. by dropping the connection mid-body
In a debug build the handler hits the DCHECK in ~GzipHTTPBodyStream(). In a release build the deflate state is leaked
The upstream report has two unit tests that reproduce it directly against GzipHTTPBodyStream.
Activity
linear-code commentedon Nov 18, 2026
NATIVE-244
jpnurmi commentedon Nov 18, 2026
Hi @bionicbeagle, thanks for the detailed report. Would you like to open a fix PR at https://github.com/getsentry/crashpad/pulls and a submodule bump PR here in sentry-native? 🙏
bionicbeagle commentedon Nov 18, 2026
Sure, opened getsentry/crashpad#180 with the fix and tests. I'll follow up with the submodule bump here once it's merged.