• 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
NSURLCache _diskCacheSyncLoop crashing on Tiger
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSURLCache _diskCacheSyncLoop crashing on Tiger


  • Subject: NSURLCache _diskCacheSyncLoop crashing on Tiger
  • From: Dalzhim Dalzhim <email@hidden>
  • Date: Mon, 8 Jun 2009 13:54:13 -0400

Hello,

I am trying to use NSURLConnection inside a NSURLProtocol subclass in order to load up some content. Although whenever I activate the cache, I start getting crashes in NSURLCache syncWithDisk on Tiger.

My code is pretty straightforward, I create a NSURLRequest object and set it's cache policy to NSURLRequestReturnCacheDataElseLoad. Then I ask a WebView to load up this request.

My NSURLProtocol subclass is then being started and I create a NSURLConnection object to do most of the work for me. The content loads just fine and displays just fine, but after some random interval, a secondary thread crashes while syncing the cache.

 Here are the delegates I am using as well as the call stack of the crashed thread:



-(NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse
{
    NSMutableURLRequest *newRequest = [request mutableCopy];
    [newRequest setTimeoutInterval:5.0];
    [newRequest setCachePolicy:NSURLRequestReturnCacheDataElseLoad];
    [newRequest autorelease];
    return newRequest;
}

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
    [[NSURLCache sharedURLCache] removeCachedResponseForRequest:[self request]];
    [[self client] URLProtocol:self didFailWithError:error];
}

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
    [[self client] URLProtocol:self didReceiveResponse:maReponse cacheStoragePolicy:NSURLCacheStorageAllowed];
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    [monData appendData:data];
}

- (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse
{
    return cachedResponse;
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    [[self client] URLProtocol:self didLoadData:monData];
    [[self client] URLProtocolDidFinishLoading:self];
}

Thread 1 Crashed:
0 com.apple.Foundation 0x92c0f0d0 _NSRaiseError + 264
1 com.apple.Foundation 0x92c0ee0c +[NSException raise:format:] + 40
2 com.apple.Foundation 0x92ceaca8 -[NSValue encodeWithCoder:] + 168
3 com.apple.Foundation 0x92c2b970 _encodeObject_old + 260
4 com.apple.Foundation 0x92c2c910 -[NSDictionary encodeWithCoder:] + 184
5 com.apple.Foundation 0x92c2b970 _encodeObject_old + 260
6 com.apple.Foundation 0x92c2be3c -[NSURLRequest encodeWithCoder:] + 416
7 com.apple.Foundation 0x92c2b970 _encodeObject_old + 260
8 com.apple.Foundation 0x92c2b388 -[NSURLCache _diskCacheExecuteWrite:] + 128
9 com.apple.Foundation 0x92c2417c -[NSURLCache _diskCacheSync] + 256
10 com.apple.CoreFoundation 0x907f2370 __CFRunLoopDoTimer + 184
11 com.apple.CoreFoundation 0x907dece8 __CFRunLoopRun + 1680
12 com.apple.CoreFoundation 0x907de29c CFRunLoopRunSpecific + 268
13 com.apple.Foundation 0x92c1c7bc +[NSURLCache _diskCacheSyncLoop:] + 152
14 com.apple.Foundation 0x92bf4118 forkThreadForFunction + 108
15 libSystem.B.dylib 0x9002bd08 _pthread_body + 96


Has anyone ever seen such a problem before? Can you help me figure out how to get this working on Tiger?

thanks!


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

This email sent to email@hidden

  • Prev by Date: Re: Redirect browser webpage.
  • Next by Date: Internet Block/Unblock on Client
  • Previous by thread: Re: Redirect browser webpage.
  • Next by thread: Internet Block/Unblock on Client
  • Index(es):
    • Date
    • Thread