IOS app hangs at __psynch_mutexwait

I am working on a browser on iOS. The UIWebview function must have a bootstrap. I am doing the following.

I am sending an async request. wait until I get a response from the server. Then I set the runLoop mode to [[NSRunLoop currentRunLoop] runMode: UITrackingRunLoopMode beforeDate: [NSDate dateWithTimeIntervalSinceNow: 0.2]]; and NSDefaultRunLoopMode so that touch events can be received and handled without the user feeling stuck.

But he often hangs on __psynch_mutexwait + 26

and control at this time stucks on [[NSRunLoop currentRunLoop] runMode: UITrackingRunLoopMode beforeDate: [NSDate dateWithTimeIntervalSinceNow: 0.2]];

see snipet code

    BOOL bDone = [object getRequestStatus:someRequest];

    while (bDone == NO)
    {

            NSAutoreleasePool *p = [[NSAutoreleasePool alloc]init];

            [[NSRunLoop currentRunLoop] runMode:UITrackingRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.2]];

            [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];

            [p release];


        bDone = [object getRequestStatus:someRequest];
    }

      

call stack

thread #1: tid = 0xe482, 0x0289f91a libsystem_kernel.dylib`__psynch_mutexwait + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x0289f91a libsystem_kernel.dylib`__psynch_mutexwait + 10
    frame #1: 0x0276019b libsystem_c.dylib`pthread_mutex_lock + 595
    frame #2: 0x0881212c WebCore`_WebTryThreadLock(bool) + 44
    frame #3: 0x088130ee WebCore`WebThreadLock + 94
    frame #4: 0x013029be UIKit`-[UIWebDocumentView(Interaction) gestureRecognizerShouldBegin:] + 188
    frame #5: 0x01459466 UIKit`-[UIGestureRecognizer _shouldBegin] + 1309
    frame #6: 0x01455d89 UIKit`-[UIGestureRecognizer setState:] + 171
    frame #7: 0x0146ac61 UIKit`-[UILongPressGestureRecognizer enoughTimeElapsed:] + 149
    frame #8: 0x021f582b libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
    frame #9: 0x0125b469 UIKit`-[UIDelayedAction timerFired:] + 83
    frame #10: 0x00ce0de7 Foundation`__NSFireTimer + 97
    frame #11: 0x03047ac6 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
    frame #12: 0x030474ad CoreFoundation`__CFRunLoopDoTimer + 1181
    frame #13: 0x0302f538 CoreFoundation`__CFRunLoopRun + 1816
    frame #14: 0x0302e9d3 CoreFoundation`CFRunLoopRunSpecific + 467
    frame #15: 0x0302e7eb CoreFoundation`CFRunLoopRunInMode + 123
    frame #16: 0x00d06e35 Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 284
    frame #17: 0x000cc7ce myapp`-[Tab webView:shouldStartLoadWithRequest:navigationType:](self=0x0bd0a3f0, _cmd=0x018ca604, wV=0x0bd0b320, request=0x13eb62a0, navigationType=UIWebViewNavigationTypeOther) + 7054 at Tab.m:1082
    frame #18: 0x0130f5a8 UIKit`-[UIWebView webView:decidePolicyForNavigationAction:request:frame:decisionListener:] + 318
    frame #19: 0x01311b74 UIKit`-[UIWebViewWebViewDelegate webView:decidePolicyForNavigationAction:request:frame:decisionListener:] + 77
    frame #20: 0x0307d91d CoreFoundation`__invoking___ + 29
    frame #21: 0x0307d82a CoreFoundation`-[NSInvocation invoke] + 362
    frame #22: 0x0307d9aa CoreFoundation`-[NSInvocation invokeWithTarget:] + 74
    frame #23: 0x077f21dd WebKit`-[_WebSafeForwarder forwardInvocation:] + 157
    frame #24: 0x030792da CoreFoundation`___forwarding___ + 458
    frame #25: 0x030790ee CoreFoundation`__forwarding_prep_0___ + 14
    frame #26: 0x07795711 WebKit`WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(void (WebCore::PolicyChecker::*)(WebCore::PolicyAction), WebCore::NavigationAction const&, WebCore::ResourceRequest const&, WTF::PassRefPtr<WebCore::FormState>) + 225
    frame #27: 0x083e9eeb WebCore`WebCore::PolicyChecker::checkNavigationPolicy(WebCore::ResourceRequest const&, WebCore::DocumentLoader*, WTF::PassRefPtr<WebCore::FormState>, void (*)(void*, WebCore::ResourceRequest const&, WTF::PassRefPtr<WebCore::FormState>, bool), void*) + 1147
    frame #28: 0x07cad932 WebCore`WebCore::FrameLoader::loadWithDocumentLoader(WebCore::DocumentLoader*, WebCore::FrameLoadType, WTF::PassRefPtr<WebCore::FormState>) + 962
    frame #29: 0x07cac94d WebCore`WebCore::FrameLoader::loadWithNavigationAction(WebCore::ResourceRequest const&, WebCore::NavigationAction const&, bool, WebCore::FrameLoadType, WTF::PassRefPtr<WebCore::FormState>) + 573
    frame #30: 0x07caa4b3 WebCore`WebCore::FrameLoader::loadURL(WebCore::KURL const&, WTF::String const&, WTF::String const&, bool, WebCore::FrameLoadType, WTF::PassRefPtr<WebCore::Event>, WTF::PassRefPtr<WebCore::FormState>) + 1299
    frame #31: 0x07ca5a12 WebCore`WebCore::FrameLoader::loadFrameRequest(WebCore::FrameLoadRequest const&, bool, bool, WTF::PassRefPtr<WebCore::Event>, WTF::PassRefPtr<WebCore::FormState>, WebCore::ShouldSendReferrer) + 722
    frame #32: 0x07ca51cd WebCore`WebCore::FrameLoader::urlSelected(WebCore::FrameLoadRequest const&, WTF::PassRefPtr<WebCore::Event>, bool, bool, WebCore::ShouldSendReferrer, WebCore::ShouldReplaceDocumentIfJavaScriptURL) + 333
    frame #33: 0x07ca4ef2 WebCore`WebCore::FrameLoader::changeLocation(WebCore::SecurityOrigin*, WebCore::KURL const&, WTF::String const&, bool, bool, bool) + 178
    frame #34: 0x07be67b3 WebCore`WebCore::DOMWindow::createWindow(WTF::String const&, WTF::AtomicString const&, WebCore::WindowFeatures const&, WebCore::DOMWindow*, WebCore::Frame*, WebCore::Frame*, void (*)(WebCore::DOMWindow*, void*), void*) + 627
    frame #35: 0x07be6eea WebCore`WebCore::DOMWindow::open(WTF::String const&, WTF::AtomicString const&, WTF::String const&, WebCore::DOMWindow*, WebCore::DOMWindow*) + 682
    frame #36: 0x0802b1e7 WebCore`WebCore::JSDOMWindow::open(JSC::ExecState*) + 631
    frame #37: 0x08022d03 WebCore`WebCore::jsDOMWindowPrototypeFunctionOpen(JSC::ExecState*) + 179
    frame #38: 0x10b37d0f
    frame #39: 0x0a2b1a7f JavaScriptCore`JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 591
    frame #40: 0x0a18ea31 JavaScriptCore`JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 97
    frame #41: 0x0a30841a JavaScriptCore`JSC::boundFunctionCall(JSC::ExecState*) + 682
    frame #42: 0x10a69a0f
    frame #43: 0x0a2b1a7f JavaScriptCore`JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 591
    frame #44: 0x0a18ea31 JavaScriptCore`JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 97
    frame #45: 0x07f60af6 WebCore`WebCore::JSMainThreadExecState::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 198
    frame #46: 0x0804af05 WebCore`WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) + 997
    frame #47: 0x07c46030 WebCore`WebCore::EventTarget::fireEventListeners(WebCore::Event*, WebCore::EventTargetData*, WTF::Vector<WebCore::RegisteredEventListener, 1ul, WTF::CrashOnOverflow>&) + 544
    frame #48: 0x07c45c40 WebCore`WebCore::EventTarget::fireEventListeners(WebCore::Event*) + 240
    frame #49: 0x07c2a328 WebCore`WebCore::MouseOrFocusEventContext::handleLocalEvents(WebCore::Event*) const + 200
    frame #50: 0x07c2b44c WebCore`WebCore::EventDispatcher::dispatch() + 1020
    frame #51: 0x0839a9f0 WebCore`WebCore::MouseEventDispatchMediator::dispatchEvent(WebCore::EventDispatcher*) const + 560
    frame #52: 0x07c2a3fa WebCore`WebCore::EventDispatcher::dispatchEvent(WebCore::Node*, WTF::PassRefPtr<WebCore::EventDispatchMediator>) + 138
    frame #53: 0x083b0111 WebCore`WebCore::Node::dispatchEvent(WTF::PassRefPtr<WebCore::Event>) + 97
    frame #54: 0x07c45a51 WebCore`WebCore::EventTarget::dispatchEvent(WTF::PassRefPtr<WebCore::Event>, int&) + 113
    frame #55: 0x08147148 WebCore`WebCore::jsNodePrototypeFunctionDispatchEvent(JSC::ExecState*) + 280
    frame #56: 0x10add30f
    frame #57: 0x0a2b1a7f JavaScriptCore`JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 591
    frame #58: 0x0a18ea31 JavaScriptCore`JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 97
    frame #59: 0x07f60af6 WebCore`WebCore::JSMainThreadExecState::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 198
    frame #60: 0x0804af05 WebCore`WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) + 997
    frame #61: 0x07c46030 WebCore`WebCore::EventTarget::fireEventListeners(WebCore::Event*, WebCore::EventTargetData*, WTF::Vector<WebCore::RegisteredEventListener, 1ul, WTF::CrashOnOverflow>&) + 544
    frame #62: 0x07c45c40 WebCore`WebCore::EventTarget::fireEventListeners(WebCore::Event*) + 240
    frame #63: 0x07c2a0d8 WebCore`WebCore::EventContext::handleLocalEvents(WebCore::Event*) const + 88
    frame #64: 0x07c2b44c WebCore`WebCore::EventDispatcher::dispatch() + 1020
    frame #65: 0x07c2bb41 WebCore`WebCore::EventDispatchMediator::dispatchEvent(WebCore::EventDispatcher*) const + 17
    frame #66: 0x07c2a3fa WebCore`WebCore::EventDispatcher::dispatchEvent(WebCore::Node*, WTF::PassRefPtr<WebCore::EventDispatchMediator>) + 138
    frame #67: 0x083b0153 WebCore`WebCore::Node::dispatchEvent(WTF::PassRefPtr<WebCore::Event>) + 163
    frame #68: 0x07c45a51 WebCore`WebCore::EventTarget::dispatchEvent(WTF::PassRefPtr<WebCore::Event>, int&) + 113
    frame #69: 0x07c36ca2 WebCore`WebCore::EventHandler::dispatchTouchEvent(WebCore::PlatformTouchEvent const&, WTF::AtomicString const&, WTF::HashMap<WebCore::EventTarget*, WTF::Vector<WTF::RefPtr<WebCore::Touch>, 0ul, WTF::CrashOnOverflow>*, WTF::PtrHash<WebCore::EventTarget*>, WTF::HashTraits<WebCore::EventTarget*>, WTF::HashTraits<WTF::Vector<WTF::RefPtr<WebCore::Touch>, 0ul, WTF::CrashOnOverflow>*> > const&, float, float) + 914
    frame #70: 0x07c38cc7 WebCore`WebCore::EventHandler::handleTouchEvent(WebCore::PlatformTouchEvent const&) + 6519
    frame #71: 0x07c34ff2 WebCore`WebCore::EventHandler::touchEvent(WebEvent*) + 66
    frame #72: 0x077b32b0 WebKit`-[WebHTMLView touch:] + 80
    frame #73: 0x087fbe9c WebCore`-[WAKView _selfHandleEvent:] + 124
    frame #74: 0x087fbdf3 WebCore`-[WAKView handleEvent:] + 67
    frame #75: 0x087ff23d WebCore`-[WAKWindow sendEventSynchronously:] + 349
    frame #76: 0x01590278 UIKit`-[UIWebBrowserView _dispatchWebEvent:] + 88
    frame #77: 0x0159074c UIKit`-[UIWebBrowserView _webTouchEventsRecognized:] + 499
    frame #78: 0x021f582b libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
    frame #79: 0x0130add8 UIKit`-[UIWebTouchEventsGestureRecognizer _processTouches:withEvent:type:] + 385
    frame #80: 0x0130b04a UIKit`-[UIWebTouchEventsGestureRecognizer touchesEnded:withEvent:] + 77
    frame #81: 0x010fd843 UIKit`-[UIWindow _sendGesturesForEvent:] + 756
    frame #82: 0x010fe971 UIKit`-[UIWindow sendEvent:] + 1021
    frame #83: 0x010d05f2 UIKit`-[UIApplication sendEvent:] + 242
    frame #84: 0x010ba353 UIKit`_UIApplicationHandleEventQueue + 11455
    frame #85: 0x0301277f CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    frame #86: 0x0301210b CoreFoundation`__CFRunLoopDoSources0 + 235
    frame #87: 0x0302f1ae CoreFoundation`__CFRunLoopRun + 910
    frame #88: 0x0302e9d3 CoreFoundation`CFRunLoopRunSpecific + 467
    frame #89: 0x0302e7eb CoreFoundation`CFRunLoopRunInMode + 123
    frame #90: 0x040445ee GraphicsServices`GSEventRunModal + 192
    frame #91: 0x0404442b GraphicsServices`GSEventRun + 104
    frame #92: 0x010bcf9b UIKit`UIApplicationMain + 1225
    frame #93: 0x00005cf8 myapp`main(argc=1, argv=0xbfffed78) + 152 at main.m:15

      

+3


source to share





All Articles