curl-library
Re: Crash on iOS during HTTPS connection (libcurl with DarwinSSL)
Date: Thu, 17 Oct 2013 22:30:03 -0500
On Oct 17, 2013, at 9:12 AM, Arcin Bozkurt <arcin.bozkurt_at_youilabs.com> wrote:
> Hi,
> I am trying to to lib curl to work with the Security framework on iOS and have a simple application where I am testing easy / multi HTTP secure connections. I have a lib curl configuration that I can run on my main thread or on a separate thread I have created (like an HTTP service thread). I have two versions, one based on curl_easy, another on curl_multi API. lib curl runs successfully if the code is on the main thread, but it will crash deep inside iOS framework if it runs on the http service thread (_retainedComponentString)
> The stack trace is below :
> * thread #6: tid = 0x2337, 0x34060e0a CoreFoundation`_retainedComponentString + 14, stop reason = EXC_BAD_ACCESS (code=2, address=0x2fe94d10)
> frame #0: 0x34060e0a CoreFoundation`_retainedComponentString + 14
> frame #1: 0x340608e8 CoreFoundation`CFURLCreateStringWithFileSystemPath + 380
> frame #2: 0x3406970c CoreFoundation`CFURLGetFileSystemRepresentation + 536
> frame #3: 0x34083a42 CoreFoundation`_CFGetFileProperties + 50
> frame #4: 0x340bc472 CoreFoundation`__CFBundleCopyFrameworkURLForExecutablePath + 650
> frame #5: 0x340838ea CoreFoundation`_CFBundleEnsureBundleExistsForImagePath + 14
> frame #6: 0x340837fc CoreFoundation`CFBundleGetBundleWithIdentifier + 96
> frame #7: 0x35e2de62 Security`SecFrameworkBundleLookup + 18
> frame #8: 0x3c3fbeea libsystem_c.dylib`pthread_once + 70
> frame #9: 0x35e2de28 Security`SecFrameworkCopyLocalizedString + 32
> frame #10: 0x35e26490 Security`obtainSummaryFromX501Name + 308
> frame #11: 0x35e29bbc Security`parseRDNContent + 100
> frame #12: 0x35e2632a Security`parseX501NameContent + 58
> frame #13: 0x35e26268 Security`SecCertificateCopySubjectSummary + 40
> frame #14: 0x003271f2 Gladiator`darwinssl_connect_common + 1766
> frame #15: 0x00321cd0 Gladiator`Curl_ssl_connect_nonblocking + 28
> frame #16: 0x0030fe06 Gladiator`https_connecting + 14
> frame #17: 0x00314186 Gladiator`Curl_protocol_connecting + 26
> frame #18: 0x0031e8ba Gladiator`multi_runsingle + 874
> frame #19: 0x0031f3ae Gladiator`curl_multi_perform + 102
> frame #20: 0x0031c364 Gladiator`curl_easy_perform + 260
> The behaviour is the same whether I use easy or multi API.
> Could the problem be related to how I have built libcurl?
No. Something is crashing deep within the framework in a routine function called by libcurl to generate verbose output (SecCertificateCopySubjectSummary). That function has never crashed on me before.
One thought: If you're seeing this in a background thread and not the main thread, then maybe your thread is exhausting its stack memory, which would cause a crash. iOS and OS X both allocate far more memory for the main thread's stack than for other threads, so does it help if you increase the stack size on that thread prior to launching it (or just using less stack memory on it)?
Nick Zitzmann
<http://www.chronosnet.com/>
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-10-18