crash closure #1 in LocalMetricsAggregator.add(type:key:value:unit:tags:)
Opened this issue · 3 comments
demonukg commented
Platform
iOS
Environment
Production
Installed
Swift Package Manager
Version
8.26.0
Xcode Version
15.3
Did it work on previous versions?
No response
Steps to Reproduce
I encountered a crash when using the experimental Metrics feature. I use this feature to log the duration of a request. This block of code is sent from a background thread each time a response is received from the server:
SentrySDK.metrics.distribution(
key: "http.requests.durations",
value: duration,
unit: MeasurementUnitDuration.second,
tags: [
"request.template": requestTemplate,
"status": "\(dataResponse.status.code)",
"locale": Locale.current.identifier
]
)
The crash is intermittent and quite difficult to reproduce. Crash logs:
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000154
Crashed: com.apple.root.user-initiated-qos.cooperative
0 moduleData 0x1b6c50 closure #1 in LocalMetricsAggregator.add(type:key:value:unit:tags:) + 6108
1 moduleData 0x1b6c4c closure #1 in LocalMetricsAggregator.add(type:key:value:unit:tags:) + 6104
2 moduleData 0x1b6ba8 LocalMetricsAggregator.add(type:key:value:unit:tags:) + 5940
3 moduleData 0x1bb6a4 closure #1 in BucketMetricsAggregator.add(type:key:value:unit:tags:localMetricsAggregator:initMetric:addValueToMetric:) + 25136
4 moduleData 0x1bb1d0 BucketMetricsAggregator.add(type:key:value:unit:tags:localMetricsAggregator:initMetric:addValueToMetric:) + 23900
5 moduleData 0x1bc4c8 protocol witness for MetricsAggregator.increment(key:value:unit:tags:localMetricsAggregator:) in conformance BucketMetricsAggregator + 28756
6 moduleData 0x1bc468 protocol witness for MetricsAggregator.distribution(key:value:unit:tags:localMetricsAggregator:) in conformance BucketMetricsAggregator + 28660
7 moduleData 0x1c6d48 SentryMetricsAPI.distribution(key:value:unit:tags:) + 4636
8 moduleData 0x27d24 HTTPLogger.endRequest(_:) + 84 (HTTPLogger.swift:84)
9 moduleData 0x4234c specialized static NSURLSession.dataResponse(for:base:_:file:function:isRepeatAfterUnauthorized:) + 142 (URLSession+.swift:142)
10 libswift_Concurrency.dylib 0x41ac4 <redacted> + 436
11 libswift_Concurrency.dylib 0x42d54 <redacted> + 72
12 libdispatch.dylib 0x15be4 <redacted> + 392
13 libdispatch.dylib 0x163ec <redacted> + 156
14 libsystem_pthread.dylib 0x1928 _pthread_wqthread + 228
15 libsystem_pthread.dylib 0x1a04 start_wqthread + 8
Expected Result
no crash
Actual Result
crash
Are you willing to submit a PR?
No response
philipphofmann commented
Thanks for reporting this, @demonukg. After a quick glance I have no clue what could cause this. We need to investigate.
demonukg commented
Hi @philipphofmann,
Any updates on this issue?