diff --git a/CHANGELOG.md b/CHANGELOG.md index ab8a28d0f..c8e0b988b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,10 @@ ### Bug Fixes - fix(stackwalking): Use debug info to inform scanning by @loewenheim in [#1905](https://github.com/getsentry/symbolicator/pull/1905) +- fix(apple): Rewind objectstore downloads so they are parsed properly by @jjbayer in [#1924](https://github.com/getsentry/symbolicator/pull/1924) ### Deps + - Bump Native SDK from 0.11.2 to 0.13.5 by @loewenheim in [#1917](https://github.com/getsentry/symbolicator/pull/1917) - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0135) - [diff](https://github.com/getsentry/sentry-native/compare/0.11.2...0.13.5) diff --git a/crates/symbolicator-native/src/symbolication/attachments.rs b/crates/symbolicator-native/src/symbolication/attachments.rs index 8c6378535..e206e4106 100644 --- a/crates/symbolicator-native/src/symbolication/attachments.rs +++ b/crates/symbolicator-native/src/symbolication/attachments.rs @@ -3,7 +3,7 @@ use std::pin::pin; use futures::TryStreamExt; use symbolicator_service::download::DownloadService; -use tokio::io::{AsyncWriteExt, BufWriter}; +use tokio::io::{AsyncSeekExt, AsyncWriteExt, BufWriter}; use tokio_util::io::StreamReader; use crate::interface::AttachmentFile; @@ -41,8 +41,10 @@ pub async fn download_attachment( let mut writer = BufWriter::new(tokio::fs::File::from_std(file)); tokio::io::copy(&mut reader, &mut writer).await?; writer.flush().await?; - let file = writer.into_inner(); + let mut file = writer.into_inner(); file.sync_data().await?; + file.rewind().await?; + Ok(file.into_std().await) } diff --git a/crates/symbolicator-native/tests/integration/main.rs b/crates/symbolicator-native/tests/integration/main.rs index 113892318..7b587de67 100644 --- a/crates/symbolicator-native/tests/integration/main.rs +++ b/crates/symbolicator-native/tests/integration/main.rs @@ -1,6 +1,7 @@ // See pub mod e2e; +pub mod process_apple; pub mod process_minidump; pub mod public_sources; pub mod source_errors; diff --git a/crates/symbolicator-native/tests/integration/process_apple.rs b/crates/symbolicator-native/tests/integration/process_apple.rs new file mode 100644 index 000000000..48123ddd7 --- /dev/null +++ b/crates/symbolicator-native/tests/integration/process_apple.rs @@ -0,0 +1,42 @@ +use std::sync::Arc; + +use axum::Router; +use axum::http::header; +use axum::response::IntoResponse; +use axum::routing::get; +use symbolicator_test::Server; + +use symbolicator_native::interface::AttachmentFile; +use symbolicator_service::types::Scope; + +use crate::{assert_snapshot, read_fixture, setup_service, symbol_server}; + +#[tokio::test] +async fn test_attachment_download() { + let (symbolication, _cache_dir) = setup_service(|_| ()); + let (_symsrv, source) = symbol_server(); + + async fn get_crash_report() -> impl IntoResponse { + let report = read_fixture("apple_crash_report.txt"); + let compressed = zstd::bulk::compress(&report, 0).unwrap(); + + ([(header::CONTENT_ENCODING, "zstd")], compressed) + } + let router = Router::new().route("/the_crash_report.txt", get(get_crash_report)); + let attachment_server = Server::with_router(router); + + let response = symbolication + .process_apple_crash_report( + None, + Scope::Global, + AttachmentFile::Remote { + storage_url: attachment_server.url("/the_crash_report.txt").to_string(), + storage_token: None, + }, + Arc::new([source]), + Default::default(), + ) + .await; + + assert_snapshot!(response.unwrap()); +} diff --git a/crates/symbolicator-native/tests/integration/snapshots/integration__process_apple__attachment_download.snap b/crates/symbolicator-native/tests/integration/snapshots/integration__process_apple__attachment_download.snap new file mode 100644 index 000000000..7d6a95a5a --- /dev/null +++ b/crates/symbolicator-native/tests/integration/snapshots/integration__process_apple__attachment_download.snap @@ -0,0 +1,215 @@ +--- +source: crates/symbolicator-native/tests/integration/process_apple.rs +expression: response.unwrap() +--- +timestamp: 1547055742 +system_info: + os_name: macOS + os_version: 10.14.0 + os_build: 18A391 + cpu_arch: x86_64 + device_model: "MacBookPro14,3" +crashed: true +crash_reason: SIGSEGV +crash_details: "objc_msgSend() selector name: respondsToSelector:\n more information here" +stacktraces: + - thread_id: 0 + is_requesting: false + frames: + - status: unknown_image + original_index: 0 + instruction_addr: "0x7fff61bc6c2a" + package: libsystem_kernel.dylib + - status: unknown_image + original_index: 1 + instruction_addr: "0x7fff349f505e" + package: CoreFoundation + - status: unknown_image + original_index: 2 + instruction_addr: "0x7fff349f45ad" + package: CoreFoundation + - status: unknown_image + original_index: 3 + instruction_addr: "0x7fff349f3ce4" + package: CoreFoundation + - status: unknown_image + original_index: 4 + instruction_addr: "0x7fff33c8d895" + package: HIToolbox + - status: unknown_image + original_index: 5 + instruction_addr: "0x7fff33c8d5cb" + package: HIToolbox + - status: unknown_image + original_index: 6 + instruction_addr: "0x7fff33c8d348" + package: HIToolbox + - status: unknown_image + original_index: 7 + instruction_addr: "0x7fff31f4a95b" + package: AppKit + - status: unknown_image + original_index: 8 + instruction_addr: "0x7fff31f496fa" + package: AppKit + - status: unknown_image + original_index: 9 + instruction_addr: "0x7fff31f4375d" + package: AppKit + - status: missing + original_index: 10 + instruction_addr: "0x108b7092b" + package: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/MacOS/YetAnotherMac + - status: missing + original_index: 11 + instruction_addr: "0x108b702a6" + package: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/MacOS/YetAnotherMac + - status: unknown_image + original_index: 12 + instruction_addr: "0x7fff61a8e085" + package: libdyld.dylib + - status: unknown_image + original_index: 13 + instruction_addr: "0xea004" + package: YetanotherMac + - thread_id: 1 + thread_name: Test Thread Name + is_requesting: true + registers: + cs: "0x2b" + fs: "0x0" + gs: "0x0" + r10: "0x0" + r11: "0xffffffff" + r12: "0x8" + r13: "0x11e800b00" + r14: "0x1" + r15: "0x0" + r8: "0x3" + r9: "0x10" + rax: "0x20261bb4775b008f" + rbp: "0x700015a616d0" + rbx: "0x0" + rcx: "0x1288266c0" + rdi: "0x0" + rdx: "0x1" + rflags: "0x10206" + rip: "0x1090a0132" + rsi: "0x0" + rsp: "0x700015a613f0" + frames: + - status: unknown_image + original_index: 0 + instruction_addr: "0x7fff61bc85be" + package: libsystem_kernel.dylib + - status: unknown_image + original_index: 1 + instruction_addr: "0x7fff61c7f415" + package: libsystem_pthread.dylib + - status: unknown_image + original_index: 2 + instruction_addr: "0x54485244" +modules: + - debug_status: missing + features: + has_debug_info: false + has_unwind_info: false + has_symbols: false + has_sources: false + arch: unknown + type: macho + code_id: 2d903291397d3d14bfca52c7fb8c5e00 + code_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/MacOS/YetAnotherMac + debug_id: 2d903291-397d-3d14-bfca-52c7fb8c5e00 + debug_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/MacOS/YetAnotherMac + image_addr: "0x10864e000" + image_size: 108797951 + candidates: + - source: local + location: "http://localhost:/symbols/2D90/3291/397D/3D14/BFCA/52C7FB8C5E00" + download: + status: notfound + - source: local + location: "http://localhost:/symbols/2D90/3291/397D/3D14/BFCA/52C7FB8C5E00.app" + download: + status: notfound + - source: local + location: "http://localhost:/symbols/2D90/3291/397D/3D14/BFCA/52C7FB8C5E00.src.zip" + download: + status: notfound + - source: local + location: "http://localhost:/symbols/2d/903291397d3d14bfca52c7fb8c5e00.debug" + download: + status: notfound + - source: local + location: "http://localhost:/symbols/YetAnotherMac/2D903291397D3D14BFCA52C7FB8C5E000/YetAnotherMa_" + download: + status: notfound + - source: local + location: "http://localhost:/symbols/YetAnotherMac/2D903291397D3D14BFCA52C7FB8C5E000/YetAnotherMac" + download: + status: notfound + - source: local + location: "http://localhost:/symbols/YetAnotherMac/2D903291397D3D14BFCA52C7FB8C5E000/YetAnotherMac.src.zip" + download: + status: notfound + - source: local + location: "http://localhost:/symbols/YetAnotherMac/2D903291397D3D14BFCA52C7FB8C5E000/YetAnotherMac.sym" + download: + status: notfound + - debug_status: unused + features: + has_debug_info: false + has_unwind_info: false + has_symbols: false + has_sources: false + arch: unknown + type: macho + code_id: 6deccee4a0523ea4bb67957b06f53ad1 + code_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/libPhysX3PROFILE.dylib + debug_id: 6deccee4-a052-3ea4-bb67-957b06f53ad1 + debug_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/libPhysX3PROFILE.dylib + image_addr: "0x112bb2000" + image_size: 2170879 + - debug_status: unused + features: + has_debug_info: false + has_unwind_info: false + has_symbols: false + has_sources: false + arch: unknown + type: macho + code_id: 5e012a646cc536f19b4da0564049169b + code_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/libPhysX3CookingPROFILE.dylib + debug_id: 5e012a64-6cc5-36f1-9b4d-a0564049169b + debug_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/libPhysX3CookingPROFILE.dylib + image_addr: "0x112fc0000" + image_size: 221183 + - debug_status: unused + features: + has_debug_info: false + has_unwind_info: false + has_symbols: false + has_sources: false + arch: unknown + type: macho + code_id: 9c19854471943de6b67e4cc27eed2eab + code_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/libPhysX3CommonPROFILE.dylib + debug_id: 9c198544-7194-3de6-b67e-4cc27eed2eab + debug_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/libPhysX3CommonPROFILE.dylib + image_addr: "0x113013000" + image_size: 1474559 + - debug_status: unused + features: + has_debug_info: false + has_unwind_info: false + has_symbols: false + has_sources: false + arch: unknown + type: macho + code_id: 890f0997f90435449af7cf011f09a06e + code_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/libPxFoundationPROFILE.dylib + debug_id: 890f0997-f904-3544-9af7-cf011f09a06e + debug_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/libPxFoundationPROFILE.dylib + image_addr: "0x1131fa000" + image_size: 28671