Re: py2app .app crashes... but only when downloaded (quarantine)

Jack Jansen <[email protected]> Thu, 2 Feb 2017 16:22:07 +0100
Newsgroups gmane.comp.python.apple
Message-ID <[email protected]>
If I look at the stack trace (for thread 0, the thread that crashes) it seems that there’s a dialog posted from the mainline code (stack frames 29/30). This may be the thing that only happens because of the quarantaine, but I guess you’ll know that better. From there, a temporary runloop is created to handle the interaction with the dialog (around frame 19), which trigger TclTk handlers (frame 15), which call back into Python (frame 4), which aborts (frame 3). The latter probably because the thread state hasn’t been initialized yet, or something like that.

My guess is that this could be caused by some early dialog that triggers a bug in your initialization code, or more precisely: the order in which you initialize things.


But really: I’m only guessing here, in the hope it’ll give you an “Aha!” moment:-)

Jack 

> On 30 Jan 2017, at 20:14, David A. Riggs <[email protected]> wrote:
> 
> I've got a bizarre issue here. I've built a .app with py2app 0.10 on my OS X 10.9.5 machine using python.org Python 2.7.12. It's a Tkinter application, with a relatively simple `setup.py`. The .app works beautifully when I build it and double-click it locally, and when I "sneaker net" it to a 10.10.5 non-development Mac.
> 
> However, if I *download* the exact same file from the Internet, Apple's Gatekeeper says that this "is an application downloaded from the Internet. Are you sure you want to open it?" When I click "Open", my Tkinter GUI very briefly appears, and then CRASH.
> 
> When I double-click the downloaded version a second time (after its first crash), it seem to work fine. Presumably OS X is clearing the com.apple.quarantine attribute during the failed first run?
> 
> Does anyone have a clue as to what could be causing this quarantine-related crash?!
> 
> The crash diagnostics follow.
> 
> You may download my .app file from the following URL if you'd like to try it yourself:
> 
>     http://myotisoft.com/wp-content/uploads/2016/10/Myotisoft_Transect-1.1.4-MacOSX.zip
> 
> Thanks for any help you can offer!
> 
> - DR
> 
> 
> Crash diagnostics:
> 
> 
> Process:         Myotisoft Transect 1.1.4 [6331]
> Path:            /Users/USER/Downloads/Myotisoft Transect 1.1.4.app/Contents/MacOS/Myotisoft Transect 1.1.4
> Identifier:      com.myotisoft.transect
> Version:         1.1.4 (1.1.4)
> Code Type:       X86-64 (Native)
> Parent Process:  launchd [273]
> Responsible:     Myotisoft Transect 1.1.4 [6331]
> User ID:         501
> 
> Date/Time:       2017-01-26 21:55:33.906 -0800
> OS Version:      Mac OS X 10.9.5 (13F34)
> Report Version:  11
> Anonymous UUID:  4FDDD4D4-D605-83FC-F213-CE2AC888F9D2
> 
> Sleep/Wake UUID: BB7BD922-CCB7-4B40-B294-2A8709CE2CFF
> 
> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
> 
> Exception Type:  EXC_CRASH (SIGABRT)
> Exception Codes: 0x0000000000000000, 0x0000000000000000
> 
> Application Specific Information:
> abort() called
> 
> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
> 0   libsystem_kernel.dylib        	0x00007fff8ccd6866 __pthread_kill + 10
> 1   libsystem_pthread.dylib       	0x00007fff8d4b335c pthread_kill + 92
> 2   libsystem_c.dylib             	0x00007fff89b04b1a abort + 125
> 3   org.python.python             	0x00000001006e9ed1 Py_FatalError + 49
> 4   org.python.python             	0x00000001006ba96f PyEval_RestoreThread + 95
> 5   _tkinter.so                   	0x0000000102a357b3 Tkapp_CallDeallocArgs + 9523
> 6   Tcl                           	0x0000000102a4c786 TclInvokeStringCommand + 124
> 7   Tcl                           	0x0000000102a4dab6 0x102a40000 + 55990
> 8   Tcl                           	0x0000000102a8dd6a 0x102a40000 + 318826
> 9   Tcl                           	0x0000000102a91dbc 0x102a40000 + 335292
> 10  Tcl                           	0x0000000102a4f73f TclEvalObjEx + 422
> 11  Tcl                           	0x0000000102ad0f92 0x102a40000 + 593810
> 12  Tcl                           	0x0000000102ad1192 0x102a40000 + 594322
> 13  Tcl                           	0x0000000102ab7a14 Tcl_ServiceEvent + 140
> 14  Tcl                           	0x0000000102ab7dd1 Tcl_ServiceAll + 173
> 15  Tcl                           	0x0000000102ae64bd 0x102a40000 + 681149
> 16  com.apple.CoreFoundation      	0x00007fff8b433d67 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
> 17  com.apple.CoreFoundation      	0x00007fff8b433cd7 __CFRunLoopDoObservers + 391
> 18  com.apple.CoreFoundation      	0x00007fff8b425493 __CFRunLoopRun + 995
> 19  com.apple.CoreFoundation      	0x00007fff8b424e75 CFRunLoopRunSpecific + 309
> 20  com.apple.HIToolbox           	0x00007fff92fa5a0d RunCurrentEventLoopInMode + 226
> 21  com.apple.HIToolbox           	0x00007fff92fa57b7 ReceiveNextEventCommon + 479
> 22  com.apple.HIToolbox           	0x00007fff92fa55bc _BlockUntilNextEventMatchingListInModeWithFilter + 65
> 23  com.apple.AppKit              	0x00007fff9020a24e _DPSNextEvent + 1434
> 24  com.apple.AppKit              	0x00007fff9020989b -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
> 25  Tk                            	0x0000000102bdba2a 0x102b25000 + 748074
> 26  com.apple.AppKit              	0x00007fff90568e2e -[NSApplication _realDoModalLoop:peek:] + 642
> 27  com.apple.AppKit              	0x00007fff9056754e -[NSApplication runModalForWindow:] + 117
> 28  com.apple.AppKit              	0x00007fff905978a2 _NXDoLocalRunAlertPanel + 427
> 29  com.apple.AppKit              	0x00007fff905976df NSRunAlertPanel + 157
> 30  com.myotisoft.transect        	0x0000000100004009 0x100000000 + 16393
> 31  com.myotisoft.transect        	0x00000001000013ff main + 1375
> 32  com.myotisoft.transect        	0x0000000100000ce4 start + 52
> 
> Thread 1:
> 0   libsystem_kernel.dylib        	0x00007fff8ccd6e6a __workq_kernreturn + 10
> 1   libsystem_pthread.dylib       	0x00007fff8d4b3f08 _pthread_wqthread + 330
> 2   libsystem_pthread.dylib       	0x00007fff8d4b6fb9 start_wqthread + 13
> 
> Thread 2:: Dispatch queue: com.apple.libdispatch-manager
> 0   libsystem_kernel.dylib        	0x00007fff8ccd7662 kevent64 + 10
> 1   libdispatch.dylib             	0x00007fff92ce1421 _dispatch_mgr_invoke + 239
> 2   libdispatch.dylib             	0x00007fff92ce1136 _dispatch_mgr_thread + 52
> 
> Thread 3:
> 0   libsystem_kernel.dylib        	0x00007fff8ccd6e6a __workq_kernreturn + 10
> 1   libsystem_pthread.dylib       	0x00007fff8d4b3f08 _pthread_wqthread + 330
> 2   libsystem_pthread.dylib       	0x00007fff8d4b6fb9 start_wqthread + 13
> 
> Thread 4:
> 0   libsystem_kernel.dylib        	0x00007fff8ccd6e6a __workq_kernreturn + 10
> 1   libsystem_pthread.dylib       	0x00007fff8d4b3f08 _pthread_wqthread + 330
> 2   libsystem_pthread.dylib       	0x00007fff8d4b6fb9 start_wqthread + 13
> 
> Thread 5:
> 0   libsystem_kernel.dylib        	0x00007fff8ccd6e6a __workq_kernreturn + 10
> 1   libsystem_pthread.dylib       	0x00007fff8d4b3f08 _pthread_wqthread + 330
> 2   libsystem_pthread.dylib       	0x00007fff8d4b6fb9 start_wqthread + 13
> 
> Thread 6:
> 0   libsystem_kernel.dylib        	0x00007fff8ccd69aa __select + 10
> 1   Tcl                           	0x0000000102ae77e9 0x102a40000 + 686057
> 2   libsystem_pthread.dylib       	0x00007fff8d4b2899 _pthread_body + 138
> 3   libsystem_pthread.dylib       	0x00007fff8d4b272a _pthread_start + 137
> 4   libsystem_pthread.dylib       	0x00007fff8d4b6fc9 thread_start + 13
> 
> Thread 7:: com.apple.appkit-heartbeat
> 0   libsystem_kernel.dylib        	0x00007fff8ccd6a3a __semwait_signal + 10
> 1   libsystem_c.dylib             	0x00007fff89b23dc0 nanosleep + 200
> 2   libsystem_c.dylib             	0x00007fff89b23cb2 usleep + 54
> 3   com.apple.AppKit              	0x00007fff9046e17d -[NSUIHeartBeat _heartBeatThread:] + 2132
> 4   com.apple.Foundation          	0x00007fff93f0cdfb __NSThread__main__ + 1318
> 5   libsystem_pthread.dylib       	0x00007fff8d4b2899 _pthread_body + 138
> 6   libsystem_pthread.dylib       	0x00007fff8d4b272a _pthread_start + 137
> 7   libsystem_pthread.dylib       	0x00007fff8d4b6fc9 thread_start + 13
> 
> Thread 0 crashed with X86 Thread State (64-bit):
>   rax: 0x0000000000000000  rbx: 0x00007fff7a160310  rcx: 0x00007fff5fbfb7b8  rdx: 0x0000000000000000
>   rdi: 0x0000000000000707  rsi: 0x0000000000000006  rbp: 0x00007fff5fbfb7e0  rsp: 0x00007fff5fbfb7b8
>    r8: 0x0000000000000040   r9: 0x00007fff5fbfb700  r10: 0x0000000008000000  r11: 0x0000000000000206
>   r12: 0x0000000000000000  r13: 0x0000000000000001  r14: 0x0000000000000006  r15: 0x00000001031516a0
>   rip: 0x00007fff8ccd6866  rfl: 0x0000000000000206  cr2: 0x0000000107e22100
>   
> Logical CPU:     0
> Error Code:      0x02000148
> Trap Number:     133
> 
> 
> 
> -- 
> David A. Riggs <[email protected]>
> 
> <Myotisoft Transect 1.1.4_2017-01-26-215534_Davids-MacBook-Pro.crash>_______________________________________________
> Pythonmac-SIG maillist  -  [email protected]
> https://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG

--
Jack Jansen, <[email protected]>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma Goldman



_______________________________________________
Pythonmac-SIG maillist  -  [email protected]
https://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG