CFNetwork crash

Hi,

We're experiencing a random CFNetwork crash in a number of our products for quite a long time. Our investigation haven't got us any helpful leads. We'd appreciate if you take a look at the crash reports attached and share your thoughts about in which direction to dig further.

Your crash reports all shown signs of a third-party crash reporter. I recommend that you remove that, for the reasons I explain in Implementing Your Own Crash Reporter.

All three of these crash reports look pretty much the same. They all seem to be caused by memory management problems. It’s hard to say anything conclusive about that but my best guess is that this is a bug in CFNetwork itself. Still, I recommend that you run a full stress test on your app with the standard memory debugging tools enabled. This is a good idea anyway, and if causes this crash to be more reproducible we might be able to figure out more.

Share and Enjoy

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

Hi Quinn,

Thank you for your quick reply. It's seems important to add that we have the same crash in one of our apps which doesn't integrate the third-party crash reporter (Unfortunately I fail to attach this specific crash report).

Could you explain a bit more about your guess that it's internal CFNetwork bug? Are there know bugs in CFNetworks? Does it mean there's no solution in this case? We're weighing now the option of fully rewriting or at least refactoring out network layer (which is partially some legacy code tbh). Do you think this can help to get rid of this crash?

Are there know bugs in CFNetworks?

I can’t remember that exact statistics but I vaguely recall some software engineering maxim than a typical program has 1 bug per 100 lines of code [1]. And CFNetwork is much larger than 100 lines (-:

Do you think this can help to get rid of this crash?

Quite possibly. It’s also quite possible that you’ll introduce other bugs that are worse.

The best path forward here is to create a test suite that exercises your networking code extensively, and then run that test suite with the standard memory debugging tools enabled. There are two possible outcomes:

  • It doesn’t crash, which gives you some assurance that whatever problem you’re seeing is either not caused by your networking code or is rare enough that you don’t need to worry too much about it.

  • It does crash, in which case you have something to debug.

Either way, this won’t be wasted effort because, even if you decide to rewrite your networking code, you can use the same test suite as part of its quality assurance.

Share and Enjoy

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

[1] Or was in 1 bug per 10 lines of code. Either way, it’s bad.

CFNetwork crash
 
 
Q