SDWebImage: Crash: SDWebImageDownloaderOperation.m line 85

New Issue Checklist

Issue Info

Info Value
Platform Name iOS
Platform Version iOS 8, 9, 10
SDWebImage Version 4.0.0
Integration Method cocoapods /
Xcode Version Xcode 8.2.1
Repro rate only found 6 crashes during last 30 days
Repro with our demo prj hard to reproduce
Demo project link no

Issue Description and Steps

Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x19489bbdc objc_msgSend + 28
1  CoreFoundation                 0x182f41458 CFRelease + 524
2  CFNetwork                      0x182999f38 HTTPRequestParserClient::~HTTPRequestParserClient() + 52
3  CFNetwork                      0x182999ef4 HTTPRequestMessage::~HTTPRequestMessage() + 80
4  CoreFoundation                 0x182f41394 CFRelease + 328
5  CFNetwork                      0x18299a144 URLRequest::~URLRequest() + 152
6  CoreFoundation                 0x182f41394 CFRelease + 328
7  CFNetwork                      0x182aa9e68 -[NSURLRequestInternal dealloc] + 40
8  CFNetwork                      0x182aab124 -[NSURLRequest dealloc] + 48
9  libobjc.A.dylib                0x194886b1c object_cxxDestructFromClass(objc_object*, objc_class*) + 148
10 libobjc.A.dylib                0x194893f38 objc_destructInstance + 92
11 libobjc.A.dylib                0x194893f90 object_dispose + 28
12 Foundation                     0x183e96b14 -[NSOperation dealloc] + 104
13 ??????                         0x1008ae4fc -[SDWebImageDownloaderOperation dealloc] (SDWebImageDownloaderOperation.m:85)
14 libsystem_blocks.dylib         0x194f31910 _Block_release + 256
15 libdispatch.dylib              0x194ed9954 _dispatch_client_callout + 16
16 libdispatch.dylib              0x194ede20c _dispatch_main_queue_callback_4CF + 1608
17 CoreFoundation                 0x18301b7f8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
18 CoreFoundation                 0x1830198a0 __CFRunLoopRun + 1492
19 CoreFoundation                 0x182f452d4 CFRunLoopRunSpecific + 396
20 GraphicsServices               0x18c75b6fc GSEventRunModal + 168
21 UIKit                          0x187b0afac UIApplicationMain + 1488
22 ??????                         0x100144178 main (main.m:14)
23 libdyld.dylib                  0x194f06a08 start + 4

@CodeStage mentioned this in #1821 . I think it’s better to open a new one.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 16 (3 by maintainers)

Commits related to this issue

Most upvoted comments

I fix this by using AlamofireImage instead… It’s more effective with more possibility.

Same use as SDWebImage: SDWebImage: _imageView.sd_setImage(with: URL: url, placeholderImage: UIImage(named: “placeholder.png”)) AlamofireImage: _imageView.af_setImage(withURL: url, placeholderImage: UIImage(named: “placeholder.png”))

Same issue here,

- (void)cancelInternal {
    if (self.isFinished) return;
    [super cancel];

    if (self.dataTask) {
        [self.dataTask cancel];
        dispatch_async(dispatch_get_main_queue(), ^{
            [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:self];
        });

        // As we cancelled the connection, its callback won't be called and thus won't
        // maintain the isFinished and isExecuting flags.
        if (self.isExecuting) self.executing = NO;
        if (!self.isFinished) self.finished = YES;
    }

    [self reset];
}

EXC_BAD_ACCESS when dispatch_async stop notification