Skip to content

Commit 4729244

Browse files
authored
fix(apple): Rewind files after fetching from objectstore (#1924)
Downloads from objectstore did not rewind the `File` object after downloading, leading to seemingly empty crash reports. This did not cause an issue for minidumps because they are mapped as `ByteView`. Follow-up: Use the existing download service (#1928). Fixes #1884.
1 parent c677861 commit 4729244

5 files changed

Lines changed: 264 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
### Bug Fixes
66

77
- fix(stackwalking): Use debug info to inform scanning by @loewenheim in [#1905](https://github.com/getsentry/symbolicator/pull/1905)
8+
- fix(apple): Rewind objectstore downloads so they are parsed properly by @jjbayer in [#1924](https://github.com/getsentry/symbolicator/pull/1924)
89

910
### Deps
11+
1012
- Bump Native SDK from 0.11.2 to 0.13.5 by @loewenheim in [#1917](https://github.com/getsentry/symbolicator/pull/1917)
1113
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0135)
1214
- [diff](https://github.com/getsentry/sentry-native/compare/0.11.2...0.13.5)

crates/symbolicator-native/src/symbolication/attachments.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::pin::pin;
33

44
use futures::TryStreamExt;
55
use symbolicator_service::download::DownloadService;
6-
use tokio::io::{AsyncWriteExt, BufWriter};
6+
use tokio::io::{AsyncSeekExt, AsyncWriteExt, BufWriter};
77
use tokio_util::io::StreamReader;
88

99
use crate::interface::AttachmentFile;
@@ -41,8 +41,10 @@ pub async fn download_attachment(
4141
let mut writer = BufWriter::new(tokio::fs::File::from_std(file));
4242
tokio::io::copy(&mut reader, &mut writer).await?;
4343
writer.flush().await?;
44-
let file = writer.into_inner();
44+
let mut file = writer.into_inner();
4545
file.sync_data().await?;
4646

47+
file.rewind().await?;
48+
4749
Ok(file.into_std().await)
4850
}

crates/symbolicator-native/tests/integration/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// See <https://matklad.github.io/2021/02/27/delete-cargo-integration-tests.html>
22

33
pub mod e2e;
4+
pub mod process_apple;
45
pub mod process_minidump;
56
pub mod public_sources;
67
pub mod source_errors;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
use std::sync::Arc;
2+
3+
use axum::Router;
4+
use axum::http::header;
5+
use axum::response::IntoResponse;
6+
use axum::routing::get;
7+
use symbolicator_test::Server;
8+
9+
use symbolicator_native::interface::AttachmentFile;
10+
use symbolicator_service::types::Scope;
11+
12+
use crate::{assert_snapshot, read_fixture, setup_service, symbol_server};
13+
14+
#[tokio::test]
15+
async fn test_attachment_download() {
16+
let (symbolication, _cache_dir) = setup_service(|_| ());
17+
let (_symsrv, source) = symbol_server();
18+
19+
async fn get_crash_report() -> impl IntoResponse {
20+
let report = read_fixture("apple_crash_report.txt");
21+
let compressed = zstd::bulk::compress(&report, 0).unwrap();
22+
23+
([(header::CONTENT_ENCODING, "zstd")], compressed)
24+
}
25+
let router = Router::new().route("/the_crash_report.txt", get(get_crash_report));
26+
let attachment_server = Server::with_router(router);
27+
28+
let response = symbolication
29+
.process_apple_crash_report(
30+
None,
31+
Scope::Global,
32+
AttachmentFile::Remote {
33+
storage_url: attachment_server.url("/the_crash_report.txt").to_string(),
34+
storage_token: None,
35+
},
36+
Arc::new([source]),
37+
Default::default(),
38+
)
39+
.await;
40+
41+
assert_snapshot!(response.unwrap());
42+
}
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
---
2+
source: crates/symbolicator-native/tests/integration/process_apple.rs
3+
expression: response.unwrap()
4+
---
5+
timestamp: 1547055742
6+
system_info:
7+
os_name: macOS
8+
os_version: 10.14.0
9+
os_build: 18A391
10+
cpu_arch: x86_64
11+
device_model: "MacBookPro14,3"
12+
crashed: true
13+
crash_reason: SIGSEGV
14+
crash_details: "objc_msgSend() selector name: respondsToSelector:\n more information here"
15+
stacktraces:
16+
- thread_id: 0
17+
is_requesting: false
18+
frames:
19+
- status: unknown_image
20+
original_index: 0
21+
instruction_addr: "0x7fff61bc6c2a"
22+
package: libsystem_kernel.dylib
23+
- status: unknown_image
24+
original_index: 1
25+
instruction_addr: "0x7fff349f505e"
26+
package: CoreFoundation
27+
- status: unknown_image
28+
original_index: 2
29+
instruction_addr: "0x7fff349f45ad"
30+
package: CoreFoundation
31+
- status: unknown_image
32+
original_index: 3
33+
instruction_addr: "0x7fff349f3ce4"
34+
package: CoreFoundation
35+
- status: unknown_image
36+
original_index: 4
37+
instruction_addr: "0x7fff33c8d895"
38+
package: HIToolbox
39+
- status: unknown_image
40+
original_index: 5
41+
instruction_addr: "0x7fff33c8d5cb"
42+
package: HIToolbox
43+
- status: unknown_image
44+
original_index: 6
45+
instruction_addr: "0x7fff33c8d348"
46+
package: HIToolbox
47+
- status: unknown_image
48+
original_index: 7
49+
instruction_addr: "0x7fff31f4a95b"
50+
package: AppKit
51+
- status: unknown_image
52+
original_index: 8
53+
instruction_addr: "0x7fff31f496fa"
54+
package: AppKit
55+
- status: unknown_image
56+
original_index: 9
57+
instruction_addr: "0x7fff31f4375d"
58+
package: AppKit
59+
- status: missing
60+
original_index: 10
61+
instruction_addr: "0x108b7092b"
62+
package: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/MacOS/YetAnotherMac
63+
- status: missing
64+
original_index: 11
65+
instruction_addr: "0x108b702a6"
66+
package: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/MacOS/YetAnotherMac
67+
- status: unknown_image
68+
original_index: 12
69+
instruction_addr: "0x7fff61a8e085"
70+
package: libdyld.dylib
71+
- status: unknown_image
72+
original_index: 13
73+
instruction_addr: "0xea004"
74+
package: YetanotherMac
75+
- thread_id: 1
76+
thread_name: Test Thread Name
77+
is_requesting: true
78+
registers:
79+
cs: "0x2b"
80+
fs: "0x0"
81+
gs: "0x0"
82+
r10: "0x0"
83+
r11: "0xffffffff"
84+
r12: "0x8"
85+
r13: "0x11e800b00"
86+
r14: "0x1"
87+
r15: "0x0"
88+
r8: "0x3"
89+
r9: "0x10"
90+
rax: "0x20261bb4775b008f"
91+
rbp: "0x700015a616d0"
92+
rbx: "0x0"
93+
rcx: "0x1288266c0"
94+
rdi: "0x0"
95+
rdx: "0x1"
96+
rflags: "0x10206"
97+
rip: "0x1090a0132"
98+
rsi: "0x0"
99+
rsp: "0x700015a613f0"
100+
frames:
101+
- status: unknown_image
102+
original_index: 0
103+
instruction_addr: "0x7fff61bc85be"
104+
package: libsystem_kernel.dylib
105+
- status: unknown_image
106+
original_index: 1
107+
instruction_addr: "0x7fff61c7f415"
108+
package: libsystem_pthread.dylib
109+
- status: unknown_image
110+
original_index: 2
111+
instruction_addr: "0x54485244"
112+
modules:
113+
- debug_status: missing
114+
features:
115+
has_debug_info: false
116+
has_unwind_info: false
117+
has_symbols: false
118+
has_sources: false
119+
arch: unknown
120+
type: macho
121+
code_id: 2d903291397d3d14bfca52c7fb8c5e00
122+
code_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/MacOS/YetAnotherMac
123+
debug_id: 2d903291-397d-3d14-bfca-52c7fb8c5e00
124+
debug_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/MacOS/YetAnotherMac
125+
image_addr: "0x10864e000"
126+
image_size: 108797951
127+
candidates:
128+
- source: local
129+
location: "http://localhost:<port>/symbols/2D90/3291/397D/3D14/BFCA/52C7FB8C5E00"
130+
download:
131+
status: notfound
132+
- source: local
133+
location: "http://localhost:<port>/symbols/2D90/3291/397D/3D14/BFCA/52C7FB8C5E00.app"
134+
download:
135+
status: notfound
136+
- source: local
137+
location: "http://localhost:<port>/symbols/2D90/3291/397D/3D14/BFCA/52C7FB8C5E00.src.zip"
138+
download:
139+
status: notfound
140+
- source: local
141+
location: "http://localhost:<port>/symbols/2d/903291397d3d14bfca52c7fb8c5e00.debug"
142+
download:
143+
status: notfound
144+
- source: local
145+
location: "http://localhost:<port>/symbols/YetAnotherMac/2D903291397D3D14BFCA52C7FB8C5E000/YetAnotherMa_"
146+
download:
147+
status: notfound
148+
- source: local
149+
location: "http://localhost:<port>/symbols/YetAnotherMac/2D903291397D3D14BFCA52C7FB8C5E000/YetAnotherMac"
150+
download:
151+
status: notfound
152+
- source: local
153+
location: "http://localhost:<port>/symbols/YetAnotherMac/2D903291397D3D14BFCA52C7FB8C5E000/YetAnotherMac.src.zip"
154+
download:
155+
status: notfound
156+
- source: local
157+
location: "http://localhost:<port>/symbols/YetAnotherMac/2D903291397D3D14BFCA52C7FB8C5E000/YetAnotherMac.sym"
158+
download:
159+
status: notfound
160+
- debug_status: unused
161+
features:
162+
has_debug_info: false
163+
has_unwind_info: false
164+
has_symbols: false
165+
has_sources: false
166+
arch: unknown
167+
type: macho
168+
code_id: 6deccee4a0523ea4bb67957b06f53ad1
169+
code_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/libPhysX3PROFILE.dylib
170+
debug_id: 6deccee4-a052-3ea4-bb67-957b06f53ad1
171+
debug_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/libPhysX3PROFILE.dylib
172+
image_addr: "0x112bb2000"
173+
image_size: 2170879
174+
- debug_status: unused
175+
features:
176+
has_debug_info: false
177+
has_unwind_info: false
178+
has_symbols: false
179+
has_sources: false
180+
arch: unknown
181+
type: macho
182+
code_id: 5e012a646cc536f19b4da0564049169b
183+
code_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/libPhysX3CookingPROFILE.dylib
184+
debug_id: 5e012a64-6cc5-36f1-9b4d-a0564049169b
185+
debug_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/libPhysX3CookingPROFILE.dylib
186+
image_addr: "0x112fc0000"
187+
image_size: 221183
188+
- debug_status: unused
189+
features:
190+
has_debug_info: false
191+
has_unwind_info: false
192+
has_symbols: false
193+
has_sources: false
194+
arch: unknown
195+
type: macho
196+
code_id: 9c19854471943de6b67e4cc27eed2eab
197+
code_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/libPhysX3CommonPROFILE.dylib
198+
debug_id: 9c198544-7194-3de6-b67e-4cc27eed2eab
199+
debug_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/libPhysX3CommonPROFILE.dylib
200+
image_addr: "0x113013000"
201+
image_size: 1474559
202+
- debug_status: unused
203+
features:
204+
has_debug_info: false
205+
has_unwind_info: false
206+
has_symbols: false
207+
has_sources: false
208+
arch: unknown
209+
type: macho
210+
code_id: 890f0997f90435449af7cf011f09a06e
211+
code_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/libPxFoundationPROFILE.dylib
212+
debug_id: 890f0997-f904-3544-9af7-cf011f09a06e
213+
debug_file: /Users/bruno/Documents/Unreal Projects/YetAnotherMac/MacNoEditor/YetAnotherMac.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/libPxFoundationPROFILE.dylib
214+
image_addr: "0x1131fa000"
215+
image_size: 28671

0 commit comments

Comments
 (0)