• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: URL loading system not threadsafe?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: URL loading system not threadsafe?


  • Subject: Re: URL loading system not threadsafe?
  • From: Henk Kampman <email@hidden>
  • Date: Fri, 18 Nov 2005 15:19:46 +0100


On 18-nov-2005, at 14:55, Fraser Speirs wrote:

On 18 Nov 2005, at 13:33, Henk Kampman wrote:

NSData* receivedData = [NSData dataWithContentsOfURL:url];

Hi Henk,

I would recommend that you use NSURLConnection instead, replacing the above with:

NSURLRequest *req = [NSURLRequest requestWithURL: url];
NSError *err;
NSURLResponse *resp;
NSData* receivedData = [NSURLConnection sendSynchronousRequest: req returningResponse: &resp error: &err];


I use that kind of code a lot in my apps.

Unfortunately it doesn't help, the app still crashes.


BTW I found the following in console.log

2005-11-18 15:06:28.114 CrashTest[2279] *** -[NSURLCacheNode encodeWithCoder:]: selector not recognized [self = 0x6218d50]
2005-11-18 15:06:28.114 CrashTest[2279] An uncaught exception was raised
2005-11-18 15:06:28.138 CrashTest[2279] *** -[NSURLCacheNode encodeWithCoder:]: selector not recognized [self = 0x6218d50]
2005-11-18 15:06:28.138 CrashTest[2279] *** Uncaught exception: <NSInvalidArgumentException> *** -[NSURLCacheNode encodeWithCoder:]: selector not recognized [self = 0x6218d50]
Nov 18 15:06:28 G5 crashdump[2294]: CrashTest crashed
Nov 18 15:06:28 G5 crashdump[2294]: crash report written to: /Users/ henk/Library/Logs/CrashReporter/CrashTest.crash.log


The crash log also varies between runs:

Thread 9 Crashed:
0 <<00000000>> 0x049af7d0 0 + 77264848
1 com.apple.SystemConfiguration 0x9137960c SCNetworkReachabilityUnscheduleFromRunLoop + 276
2 com.apple.CoreFoundation 0x9076c954 CFArrayApplyFunction + 416
3 com.apple.CFNetwork 0x90f2a158 _SocketStreamUnschedule_NoLock + 224
4 com.apple.CFNetwork 0x90f1bb48 _SocketStreamClose + 88
5 com.apple.CoreFoundation 0x9076e0e8 _CFStreamClose + 112
6 com.apple.CFNetwork 0x90f1be88 httpRdFilterClose + 40
7 com.apple.CoreFoundation 0x9076e0e8 _CFStreamClose + 112
8 com.apple.CFNetwork 0x90f1ba8c shutdownConnectionStreams + 120
9 com.apple.CoreFoundation 0x9073d4f4 _CFRelease + 240
10 com.apple.CoreFoundation 0x9076e0e8 _CFStreamClose + 112
11 com.apple.Foundation 0x92a1be30 - [NSConnectionHTTPURLProtocol destroyReadStream] + 64
12 com.apple.Foundation 0x9290afb4 - [NSConnectionHTTPURLProtocol deallocateCFNetworkResources] + 172
13 com.apple.Foundation 0x9290ac5c -[NSURLConnection (NSURLConnectionInternal) _cleanup] + 68
14 com.apple.Foundation 0x92908d0c readStreamCallback2 + 616
15 com.apple.CoreFoundation 0x907aa334 _CFStreamSignalEventSynch + 332
16 com.apple.CoreFoundation 0x9075da5c __CFRunLoopDoSources0 + 384
17 com.apple.CoreFoundation 0x9075cf8c __CFRunLoopRun + 452
18 com.apple.CoreFoundation 0x9075ca0c CFRunLoopRunSpecific + 268
19 com.apple.Foundation 0x92902b9c +[NSURLConnection (NSURLConnectionInternal) _resourceLoadLoop:] + 264
20 com.apple.Foundation 0x928db6d4 forkThreadForFunction + 108
21 libSystem.B.dylib 0x9002b200 _pthread_body + 96


----------

Thread 10 Crashed:
0 com.apple.Foundation 0x928f6620 _NSRaiseError + 264
1 com.apple.Foundation 0x928f635c +[NSException raise:format:] + 40
2 com.apple.Foundation 0x928cf48c -[NSObject (NSForwardInvocation) forward::] + 176
3 libobjc.A.dylib 0x909c40d0 _objc_msgForward + 176
4 com.apple.Foundation 0x92912ddc _encodeObject_old + 260
5 com.apple.Foundation 0x92913fe8 -[NSCachedURLResponse encodeWithCoder:] + 96
6 com.apple.Foundation 0x92912ddc _encodeObject_old + 260
7 com.apple.Foundation 0x92912804 -[NSURLCache _diskCacheExecuteWrite:] + 144
8 com.apple.Foundation 0x9290b5e8 -[NSURLCache _diskCacheSync] + 256
9 com.apple.CoreFoundation 0x90770ae0 __CFRunLoopDoTimer + 184
10 com.apple.CoreFoundation 0x9075d458 __CFRunLoopRun + 1680
11 com.apple.CoreFoundation 0x9075ca0c CFRunLoopRunSpecific + 268
12 com.apple.Foundation 0x92903cdc +[NSURLCache _diskCacheSyncLoop:] + 152
13 com.apple.Foundation 0x928db6d4 forkThreadForFunction + 108
14 libSystem.B.dylib 0x9002b200 _pthread_body + 96


---------

Thread 5 Crashed:
0 com.apple.CoreFoundation 0x9073e648 CFStringGetLength + 52
1 com.apple.CoreFoundation 0x90743830 CFStringAppend + 296
2 com.apple.CFNetwork 0x90f1799c _CFHTTPMessageCopySerializedHeaders + 252
3 com.apple.CFNetwork 0x90f17530 transmitHeader + 692
4 com.apple.CFNetwork 0x90f148e8 httpWrFilterCanWrite + 168
5 com.apple.CFNetwork 0x90f171f8 httpWrFilterStreamCallBack + 260
6 com.apple.CoreFoundation 0x907aa334 _CFStreamSignalEventSynch + 332
7 com.apple.CFNetwork 0x90f298a0 _SocketCallBack + 1004
8 com.apple.CoreFoundation 0x907709a0 __CFSocketDoCallback + 624
9 com.apple.CoreFoundation 0x90770668 __CFSocketPerformV0 + 288
10 com.apple.CoreFoundation 0x9075db14 __CFRunLoopDoSources0 + 568
11 com.apple.CoreFoundation 0x9075cf8c __CFRunLoopRun + 452
12 com.apple.CoreFoundation 0x9075ca0c CFRunLoopRunSpecific + 268
13 com.apple.Foundation 0x92902b9c +[NSURLConnection (NSURLConnectionInternal) _resourceLoadLoop:] + 264
14 com.apple.Foundation 0x928db6d4 forkThreadForFunction + 108
15 libSystem.B.dylib 0x9002b200 _pthread_body + 96


--------

Thread 8 Crashed:
0 <<00000000>> 0xfffefec0 objc_assign_ivar_rtp + 0
1 com.apple.Foundation 0x929323b8 -[NSURLCache _memoryCacheRemoveNodeFromLRUList:] + 196
2 com.apple.Foundation 0x92911a5c -[NSURLCache _memoryCacheRemove:] + 144
3 com.apple.Foundation 0x92910078 -[NSURLCache storeCachedResponse:forRequest:] + 200
4 com.apple.Foundation 0x9290bf1c -[NSURLConnection (NSURLConnectionInternal) _sendCallbacks] + 512
5 com.apple.Foundation 0x9290bca0 _sendCallbacks + 156
6 com.apple.CoreFoundation 0x9075da5c __CFRunLoopDoSources0 + 384
7 com.apple.CoreFoundation 0x9075cf8c __CFRunLoopRun + 452
8 com.apple.CoreFoundation 0x9075ca0c CFRunLoopRunSpecific + 268
9 com.apple.Foundation 0x9290bafc - [NSSynchronousURLConnectionDelegate run:] + 112
10 com.apple.Foundation 0x9290b970 +[NSURLConnection sendSynchronousRequest:returningResponse:error:] + 88
11 com.yourcompany.CrashTest 0x00002af8 -[MainController testThread:] + 204 (crt.c:355)
12 com.apple.Foundation 0x928db6d4 forkThreadForFunction + 108
13 libSystem.B.dylib 0x9002b200 _pthread_body + 96






_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >URL loading system not threadsafe? (From: Henk Kampman <email@hidden>)

  • Prev by Date: Re: App window remaining invisible after maximize from Dock(CORRECTIONS)
  • Next by Date: Key-Value Coding default accessor search implementation
  • Previous by thread: URL loading system not threadsafe?
  • Next by thread: Re: URL loading system not threadsafe?
  • Index(es):
    • Date
    • Thread