You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue is triggered when multiple concurrent tasks try to access the dataLoaders's dictionary inside the HTTPDataLoader class. This dictionary stored in-progress tasks by using as a key the URLSessionTask instance created by the underlying URLSession and as a value the HTTPDataLoaderResponse object.
This error can trigger an EXC_BAD_ACCESS crash both on-device and on simulator.
You can reproduce this issue easily by executing a great amount of concurrent tasks:
func test_concurrentNetworkCallsCrash()asyncthrows{varrequests=[HTTPRequest]()letnewClient=HTTPClient(baseURL:nil)for_in0..<100{letreq=try!HTTPRequest(method:.get,"https://www.apple.com")
requests.append(req)}awaitwithThrowingTaskGroup(of:HTTPResponse.self, body:{ group inforreqin requests {
group.addTask(priority:.high){letresult=tryawait req.fetch(newClient)print(result.data?.count ??0)return result
}}})}
We could fix it by using a lock on write.
The text was updated successfully, but these errors were encountered:
Bug Report
The issue is triggered when multiple concurrent tasks try to access the
dataLoaders
's dictionary inside theHTTPDataLoader
class. This dictionary stored in-progress tasks by using as a key theURLSessionTask
instance created by the underlyingURLSession
and as a value theHTTPDataLoaderResponse
object.This error can trigger an EXC_BAD_ACCESS crash both on-device and on simulator.
You can reproduce this issue easily by executing a great amount of concurrent tasks:
We could fix it by using a lock on write.
The text was updated successfully, but these errors were encountered: