Skip to content

Commit 89abe5b

Browse files
jpnurmiclaude
andauthored
ref(crashpad): pass predefined report ID (#1488)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent da666a8 commit 89abe5b

4 files changed

Lines changed: 26 additions & 3 deletions

File tree

src/backends/sentry_backend_crashpad.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,9 @@ crashpad_backend_startup(
539539

540540
std::vector<std::string> arguments { "--no-rate-limit" };
541541

542+
char report_id[37];
543+
sentry_uuid_as_string(&data->crash_event_id, report_id);
544+
542545
// Initialize database first, flushing the consent later on as part of
543546
// `sentry_init` will persist the upload flag.
544547
data->db = crashpad::CrashReportDatabase::Initialize(database).release();
@@ -564,7 +567,8 @@ crashpad_backend_startup(
564567
minidump_url ? minidump_url : "", proxy_url, annotations, arguments,
565568
/* restartable */ true,
566569
/* asynchronous_start */ false, attachments, screenshot,
567-
options->crashpad_wait_for_upload, crash_reporter, crash_envelope);
570+
options->crashpad_wait_for_upload, crash_reporter, crash_envelope,
571+
report_id);
568572
sentry_free(minidump_url);
569573

570574
#ifdef SENTRY_PLATFORM_WINDOWS

tests/assertions.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ def assert_crashpad_upload(req, expect_attachment=False, expect_view_hierarchy=F
475475
and b"\n\nMDMP" in part.as_bytes()
476476
for part in msg.walk()
477477
)
478+
return attachments
478479

479480

480481
def assert_gzip_file_header(output):
@@ -495,3 +496,14 @@ def assert_failed_proxy_auth_request(stdout):
495496
and "407 Proxy Authentication Required" in stdout
496497
and "200 OK" not in stdout
497498
)
499+
500+
501+
def wait_for_file(path, timeout=10.0, poll_interval=0.1):
502+
import time
503+
504+
deadline = time.time() + timeout
505+
while time.time() < deadline:
506+
if path.exists():
507+
return True
508+
time.sleep(poll_interval)
509+
return False

tests/test_integration_crashpad.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
assert_gzip_file_header,
3232
assert_logs,
3333
assert_user_feedback,
34+
wait_for_file,
3435
)
3536

3637
pytestmark = pytest.mark.skipif(
@@ -410,11 +411,17 @@ def test_crashpad_dumping_crash(cmake, httpserver, run_args, build_args):
410411

411412
envelope = Envelope.deserialize(session)
412413
assert_session(envelope, {"status": "crashed", "errors": 1})
413-
assert_crashpad_upload(
414+
attachments = assert_crashpad_upload(
414415
multipart,
415416
expect_attachment="clear-attachments" not in run_args,
416417
expect_view_hierarchy="clear-attachments" not in run_args,
417418
)
419+
event_id = attachments.event["event_id"]
420+
if sys.platform == "win32":
421+
minidump = tmp_path / ".sentry-native" / "reports" / f"{event_id}.dmp"
422+
else:
423+
minidump = tmp_path / ".sentry-native" / "completed" / f"{event_id}.dmp"
424+
assert wait_for_file(minidump)
418425

419426

420427
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)