Investigating CFNetwork Crashes on Older macOS Versions

CFNetwork None CFURLResponseGetRecommendedCachePolicy None 0 CFNetwork None CFHTTPCookieStorageUnscheduleFromRunLoop None 0 CFNetwork None /_/_CFNetworkAgentMessageProcessorMain None 0 CFNetwork None CFURLDownloadCancel None 0 CFNetwork None CFURLDownloadCancel None 0 libdispatch.dylib None /_dispatch/_block/_async/_invoke2 None

We've observed intermittent crashes in our production environment, exclusively affecting customers running macOS 10.15 and 11. The crash logs consistently show a stack trace involving CFHTTPCookieStorageUnscheduleFromRunLoop and CFURLDownloadCancel within the CFNetwork framework. This suggests potential issues with cookie storage management and/or URL download cancellation. Could the team please analyze these crash logs and provide insights into:

The root cause of the crashes. Potential race conditions or synchronization issues. Recommendations for mitigating or resolving the problem. Your assistance in resolving this issue is greatly appreciated."

Answered by DTS Engineer in 828113022

It seems likely that this was a bug in the old OS releases that’s since been fixed. I doubt there’s anything you can do about it in your code. You could file a bug asking for the fix to be backported to those old systems, but I don’t think it’s worth your time [1]. My only advice is that you raise your product’s deployment target to macOS 12.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Based on my reading of Apple security releases, those releases are old enough that they’re not even receiving security updates.

Attempted to dereference null pointer.

Thread 42 Crashed: 0 CFNetwork 0xfffe5be31297 CFURLResponseGetRecommendedCachePolicy 1 CFNetwork 0xfffe5bf9b800 CFHTTPCookieStorageUnscheduleFromRunLoop 2 CFNetwork 0xfffe5bfe9f3f __CFNetworkAgentMessageProcessorMain 3 CFNetwork 0xfffe5bf0af1a CFURLDownloadCancel 4 libdispatch.dylib 0xfffed0d986c3 _dispatch_call_block_and_release 5 libdispatch.dylib 0xfffed0d99657 _dispatch_client_callout 6 libdispatch.dylib 0xfffed0d9ec43 _dispatch_lane_serial_drain 7 libdispatch.dylib 0xfffed0d9f608 _dispatch_lane_invoke 8 libdispatch.dylib 0xfffed0da07ac _dispatch_workloop_invoke 9 libdispatch.dylib 0xfffed0da8c08 _dispatch_workloop_worker_thread 10 libsystem_pthread.dylib 0xfffed124da3c _pthread_wqthread 11 libsystem_pthread.dylib 0xfffed124cb76 start_wqthread

It seems likely that this was a bug in the old OS releases that’s since been fixed. I doubt there’s anything you can do about it in your code. You could file a bug asking for the fix to be backported to those old systems, but I don’t think it’s worth your time [1]. My only advice is that you raise your product’s deployment target to macOS 12.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Based on my reading of Apple security releases, those releases are old enough that they’re not even receiving security updates.

Thanks for your comment. Is there any place I can find the OS bug information?

Written by checknow in 828284022
Is there any place I can find the OS bug information?

Not really.

In general, you can only get information about bugs that you filed [1]. In some cases we might mention a bug in the macOS Release Notes, or here on the forums, or another developer might discuss a bug that they filed. However, bugs like this are a dime a dozen, so it’s unlikely to have made the release notes, and it’ll be very hard to distinguish any online discussion of it from the bazillion other similar bugs.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] See Bug Reporting: How and Why? for more information about this process.

Investigating CFNetwork Crashes on Older macOS Versions
 
 
Q