Afnetworking: EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000010 -- version 2.5.4

Created on 7 Sep 2016  路  3Comments  路  Source: AFNetworking/AFNetworking

recently I received few crashes like this, could some one take a look thanks a lot

0. Crashed: com.apple.main-thread

0 libobjc.A.dylib 0x180e9db90 objc_msgSend + 16
1 CoreFoundation 0x18170f974 +[__NSDictionaryI __new:::::] + 428
2 CoreFoundation 0x18174f010 -[NSDictionary initWithDictionary:copyItems:] + 464
3 CoreFoundation 0x18174ee2c +[NSDictionary dictionaryWithDictionary:] + 48
4 ProtonMail 0x10032b8fc -AFHTTPRequestSerializer HTTPRequestHeaders
5 ProtonMail 0x10032ccc8 -AFHTTPRequestSerializer requestBySerializingRequest:withParameters:error:
6 ProtonMail 0x100330c30 -AFJSONRequestSerializer requestBySerializingRequest:withParameters:error:
7 ProtonMail 0x10032c0a0 -AFHTTPRequestSerializer requestWithMethod:URLString:parameters:error:
8 ProtonMail 0x100322310 -AFHTTPSessionManager dataTaskWithHTTPMethod:URLString:parameters:success:failure:
9 ProtonMail 0x100321808 -AFHTTPSessionManager GET:parameters:success:failure:

Most helpful comment

Even though this is an old issue I thought I'd post it here for others experiencing similar crashes.

This issue is happening due to concurrent network requests accessing/modifying the HTTPHeader dictionary in a non-thread safe manner. Newer versions of this library have fixed the problem by accessing & modifying the header dictionary through its own private queue so you can either upgrade your version of the library or if that is not practical, wrap your calls to modify and access the http headers with @syncronized {} or using a dispatch queue.

All 3 comments

Even though this is an old issue I thought I'd post it here for others experiencing similar crashes.

This issue is happening due to concurrent network requests accessing/modifying the HTTPHeader dictionary in a non-thread safe manner. Newer versions of this library have fixed the problem by accessing & modifying the header dictionary through its own private queue so you can either upgrade your version of the library or if that is not practical, wrap your calls to modify and access the http headers with @syncronized {} or using a dispatch queue.

Can you mention the version where it got fixed? Currently i am using AFNetworking 3.1.0 and i have this issue.

Looks like this was fixed in #3526, which was released in AFNetworking 3.2. Can you try 3.2.1 and report back?

Was this page helpful?
0 / 5 - 0 ratings