When using the OpenTelemetry-Swift SDK in conjunction with the GoogleMaps SDK within our iOS application, we've encountered a critical issue resulting in crashes. The problem arises specifically due to the automated URLSessionInstrumentation feature of the OpenTelemetry-Swift SDK.
Problem Details:
The crash seems to be occurring during the swizzling process of URLSession's resume operations. It appears that some requests, particularly those invoked by the GoogleMaps SDK, when intercepted by the OpenTelemetry instrumentation, may carry a nilcurrentRequest. This leads to assertions and API misuse errors, causing the application to crash.
Error Logs:
API MISUSE: Resuming an NSURLSessionTask with nil URL.
httpCanHandleRequest(): Called for a nullptr request!
_canHandleRequest(): called with a NULL request
_canHandleRequest(): called with a NULL request
assertion failure
API MISUSE: Resuming an NSURLSessionTask with nil URL.
Steps to Reproduce:
Integrate the OpenTelemetry-Swift SDK into an iOS application.
Integrate the GoogleMaps SDK into the same application.
Observe crashes occurring intermittently, particularly when requests are invoked by the GoogleMaps SDK, with the provided error logs.
Workaround:
A potential workaround for this issue is to implement defensive checks against requests carried by the anyTask object accessible in blocks. By ensuring that proper checks are in place to handle nilcurrentRequest instances, the likelihood of crashes caused by API misuse errors can be reduced.
Impact:
This issue severely impacts the stability of applications utilizing both OpenTelemetry-Swift and GoogleMaps SDKs, particularly when requests are invoked by the GoogleMaps SDK, potentially leading to crashes and user dissatisfaction. As such, resolving this problem is crucial for maintaining the reliability of affected applications.
Issue Description:
When using the OpenTelemetry-Swift SDK in conjunction with the GoogleMaps SDK within our iOS application, we've encountered a critical issue resulting in crashes. The problem arises specifically due to the automated URLSessionInstrumentation feature of the OpenTelemetry-Swift SDK.
Problem Details:
The crash seems to be occurring during the swizzling process of URLSession's resume operations. It appears that some requests, particularly those invoked by the GoogleMaps SDK, when intercepted by the OpenTelemetry instrumentation, may carry a
nil
currentRequest
. This leads to assertions and API misuse errors, causing the application to crash.Error Logs:
Steps to Reproduce:
Workaround:
A potential workaround for this issue is to implement defensive checks against requests carried by the
anyTask
object accessible in blocks. By ensuring that proper checks are in place to handlenil
currentRequest
instances, the likelihood of crashes caused by API misuse errors can be reduced.Impact:
This issue severely impacts the stability of applications utilizing both OpenTelemetry-Swift and GoogleMaps SDKs, particularly when requests are invoked by the GoogleMaps SDK, potentially leading to crashes and user dissatisfaction. As such, resolving this problem is crucial for maintaining the reliability of affected applications.
Additional Information:
Crash report 1: CFURLRequestSetHTTPRequestBodyParts EXC_BAD_ACCESS (KERN_INVALID_ADDRESS)
Crash report 2: CFURLConnectionInvalidateConnectionCache EXC_BAD_ACCESS (KERN_INVALID_ADDRESS)