{"action":"created","issue":{"url":"https://api.github.com/repos/rs/SDWebImage/issues/691","labels_url":"https://api.github.com/repos/rs/SDWebImage/issues/691/labels{/name}","comments_url":"https://api.github.com/repos/rs/SDWebImage/issues/691/comments","events_url":"https://api.github.com/repos/rs/SDWebImage/issues/691/events","html_url":"https://github.com/rs/SDWebImage/issues/691","id":31422036,"number":691,"title":"Crash at -[SDWebImageDownloaderOperation start]","user":{"login":"loretoparisi","id":163333,"avatar_url":"https://avatars.githubusercontent.com/u/163333?v=3","gravatar_id":"","url":"https://api.github.com/users/loretoparisi","html_url":"https://github.com/loretoparisi","followers_url":"https://api.github.com/users/loretoparisi/followers","following_url":"https://api.github.com/users/loretoparisi/following{/other_user}","gists_url":"https://api.github.com/users/loretoparisi/gists{/gist_id}","starred_url":"https://api.github.com/users/loretoparisi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loretoparisi/subscriptions","organizations_url":"https://api.github.com/users/loretoparisi/orgs","repos_url":"https://api.github.com/users/loretoparisi/repos","events_url":"https://api.github.com/users/loretoparisi/events{/privacy}","received_events_url":"https://api.github.com/users/loretoparisi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rs/SDWebImage/labels/crash","name":"crash","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/rs/SDWebImage/milestones/3","labels_url":"https://api.github.com/repos/rs/SDWebImage/milestones/3/labels","id":696126,"number":3,"title":"4.0.0","description":"","creator":{"login":"bpoplauschi","id":154913,"avatar_url":"https://avatars.githubusercontent.com/u/154913?v=3","gravatar_id":"","url":"https://api.github.com/users/bpoplauschi","html_url":"https://github.com/bpoplauschi","followers_url":"https://api.github.com/users/bpoplauschi/followers","following_url":"https://api.github.com/users/bpoplauschi/following{/other_user}","gists_url":"https://api.github.com/users/bpoplauschi/gists{/gist_id}","starred_url":"https://api.github.com/users/bpoplauschi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bpoplauschi/subscriptions","organizations_url":"https://api.github.com/users/bpoplauschi/orgs","repos_url":"https://api.github.com/users/bpoplauschi/repos","events_url":"https://api.github.com/users/bpoplauschi/events{/privacy}","received_events_url":"https://api.github.com/users/bpoplauschi/received_events","type":"User","site_admin":false},"open_issues":53,"closed_issues":27,"state":"open","created_at":"2014-06-19T19:21:07Z","updated_at":"2015-01-07T08:33:05Z","due_on":null,"closed_at":null},"comments":31,"created_at":"2014-04-13T20:25:26Z","updated_at":"2015-01-14T10:42:21Z","closed_at":null,"body":"OS: iOS 7.1\r\nDevice: iPhone5\r\nStacktrace:\r\n\r\nThread : Fatal Exception: NSGenericException\r\n0  CoreFoundation                 0x2d93ef03 __exceptionPreprocess + 130\r\n1  libobjc.A.dylib                0x380d3ce7 objc_exception_throw + 38\r\n2  CoreFoundation                 0x2d93e9f1 -[NSException name]\r\n3  Foundation                     0x2e2a8b27 -[NSISEngine substituteOutAllOccurencesOfBodyVar:withExpression:] + 442\r\n4  Foundation                     0x2e2ab797 -[NSISEngine pivotToMakeBodyVar:newHeadOfRowWithHead:andDropRow:] + 338\r\n5  Foundation                     0x2e2a9541 -[NSISEngine minimizeConstantInObjectiveRowWithHead:] + 236\r\n6  Foundation                     0x2e2abf97 -[NSISEngine tryUsingArtificialVariableToAddConstraintWithMarker:rowBody:usingInfeasibilityHandlingBehavior:mutuallyExclusiveConstraints:] + 226\r\n7  Foundation                     0x2e2a7811 -[NSISEngine tryToAddConstraintWithMarker:expression:integralizationAdjustment:mutuallyExclusiveConstraints:] + 692\r\n8  Foundation                     0x2e2a744f -[NSLayoutConstraint _addLoweredExpression:toEngine:integralizationAdjustment:lastLoweredConstantWasRounded:mutuallyExclusiveConstraints:] + 282\r\n9  Foundation                     0x2e2a516d -[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 228\r\n10 UIKit                          0x3025e27d -[UIView(UIConstraintBasedLayout) _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 368\r\n11 UIKit                          0x302655c9 -[UIView(UIConstraintBasedLayout) _constraints_didChangeAutoresizingConstraintsArrayForContainedView:] + 196\r\n12 UIKit                          0x3025e90d -[UIView(UIConstraintBasedLayout) _updateAutoresizingConstraints] + 112\r\n13 UIKit                          0x3025e84d -[UIView(AdditionalLayoutSupport) updateConstraints] + 120\r\n14 UIKit                          0x306fa2f3 -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 246\r\n15 UIKit                          0x3026224b -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 126\r\n16 CoreFoundation                 0x2d8721d9 CFArrayApplyFunction + 36\r\n17 UIKit                          0x306fa28d -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 144\r\n18 UIKit                          0x3026224b -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 126\r\n19 CoreFoundation                 0x2d8721d9 CFArrayApplyFunction + 36\r\n20 UIKit                          0x306fa28d -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 144\r\n21 UIKit                          0x3026224b -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 126\r\n22 CoreFoundation                 0x2d8721d9 CFArrayApplyFunction + 36\r\n23 UIKit                          0x306fa28d -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 144\r\n24 UIKit                          0x3026224b -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 126\r\n25 CoreFoundation                 0x2d8721d9 CFArrayApplyFunction + 36\r\n26 UIKit                          0x306fa28d -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 144\r\n27 UIKit                          0x3026224b -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 126\r\n28 Foundation                     0x2e2a4d33 -[NSISEngine withBehaviors:performModifications:] + 210\r\n29 UIKit                          0x3027c0e7 -[UIWindow(UIConstraintBasedLayout) updateConstraintsIfNeeded] + 218\r\n30 UIKit                          0x301ead1f -[UIWindow(UIConstraintBasedLayout) layoutSublayersOfLayer:] + 86\r\n31 QuartzCore                     0x2fdea31b -[CALayer layoutSublayers] + 142\r\n32 QuartzCore                     0x2fde5b3f CA::Layer::layout_if_needed(CA::Transaction*) + 350\r\n33 QuartzCore                     0x2fde59d1 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16\r\n34 QuartzCore                     0x2fde53e5 CA::Context::commit_transaction(CA::Transaction*) + 228\r\n35 QuartzCore                     0x2fde51f7 CA::Transaction::commit() + 314\r\n36 QuartzCore                     0x2fddef1d CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 56\r\n37 CoreFoundation                 0x2d90a031 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20\r\n38 CoreFoundation                 0x2d9079bf __CFRunLoopDoObservers + 286\r\n39 CoreFoundation                 0x2d907d0b __CFRunLoopRun + 738\r\n40 CoreFoundation                 0x2d8727a9 CFRunLoopRunSpecific + 524\r\n41 CoreFoundation                 0x2d8b63cb CFRunLoopRun + 98\r\n42 musiXmatch                     0x001d9853 -[SDWebImageDownloaderOperation start] (SDWebImageDownloaderOperation.m:98)\r\n43 Foundation                     0x2e316745 __NSOQSchedule_f + 60\r\n44 libdispatch.dylib              0x385c125f _dispatch_async_redirect_invoke + 110\r\n45 libdispatch.dylib              0x385c2689 _dispatch_root_queue_drain + 228\r\n46 libdispatch.dylib              0x385c28dd _dispatch_worker_thread2 + 56\r\n47 libsystem_pthread.dylib        0x386edc17 _pthread_wqthread + 298\r\n48 libsystem_pthread.dylib        0x386edadc start_wqthread + 8"},"comment":{"url":"https://api.github.com/repos/rs/SDWebImage/issues/comments/69898363","html_url":"https://github.com/rs/SDWebImage/issues/691#issuecomment-69898363","issue_url":"https://api.github.com/repos/rs/SDWebImage/issues/691","id":69898363,"user":{"login":"mingweizhang","id":7930911,"avatar_url":"https://avatars.githubusercontent.com/u/7930911?v=3","gravatar_id":"","url":"https://api.github.com/users/mingweizhang","html_url":"https://github.com/mingweizhang","followers_url":"https://api.github.com/users/mingweizhang/followers","following_url":"https://api.github.com/users/mingweizhang/following{/other_user}","gists_url":"https://api.github.com/users/mingweizhang/gists{/gist_id}","starred_url":"https://api.github.com/users/mingweizhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mingweizhang/subscriptions","organizations_url":"https://api.github.com/users/mingweizhang/orgs","repos_url":"https://api.github.com/users/mingweizhang/repos","events_url":"https://api.github.com/users/mingweizhang/events{/privacy}","received_events_url":"https://api.github.com/users/mingweizhang/received_events","type":"User","site_admin":false},"created_at":"2015-01-14T10:42:21Z","updated_at":"2015-01-14T10:42:21Z","body":"Paste from another issue with same crash causing method:\r\n\r\nSDWebImageCompat.h defines a dispatch_main_sync_safe macro. I wrapped the entire [SDWebImageDownloaderOperation start] method inside this auto main thread detecting safe macro. Crashes stopped, images still load.\r\n\r\nCrash might be slightly different, my logs say stop calling this ( CFRunLoopRun();) on a back thread. Same method getting the blame on logs though.\r\n\r\n@karsawu  @bpoplauschi what about this solution offered by @yarmoshy?"}}