mpv 0.29 release branch (installed with brew cask)
macOS 10.13.6
Open a video and repeated toggle fullscreen (by pressing F)
[1] 69670 illegal hardware instruction mpv -v test.mp4
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
frame #0: 0x0000000100130559 mpv`function signature specialization <Arg[0] = Owned To Guaranteed, Arg[1] = Owned To Guaranteed> of closure #1 (__ObjC.NSAnimationContext) -> () in macOS_swift.Window.endAnimation(__C.CGRect) -> () + 441
mpv`function signature specialization <Arg[0] = Owned To Guaranteed, Arg[1] = Owned To Guaranteed> of closure #1 (__ObjC.NSAnimationContext) -> () in macOS_swift.Window.endAnimation(__C.CGRect) -> ():
-> 0x100130559 <+441>: ud2
0x10013055b <+443>: nopl (%rax,%rax)
mpv`function signature specialization <Arg[0] = Exploded> of macOS_swift.Window.updateMovableBackground(__C.CGPoint) -> ():
0x100130560 <+0>: pushq %rbp
0x100130561 <+1>: movq %rsp, %rbp
Target 0: (mpv) stopped.
Another crash with stacktrace:
Process 70793 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x00007fff75b2b597 libobjc.A.dylib`objc_msgSend_stret + 23
libobjc.A.dylib`objc_msgSend_stret:
-> 0x7fff75b2b597 <+23>: andq (%rsi), %r10
0x7fff75b2b59a <+26>: movq %rdx, %r11
0x7fff75b2b59d <+29>: andl 0x18(%r10), %r11d
0x7fff75b2b5a1 <+33>: shlq $0x4, %r11
Target 0: (mpv) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
* frame #0: 0x00007fff75b2b597 libobjc.A.dylib`objc_msgSend_stret + 23
frame #1: 0x0000000100130438 mpv`function signature specialization <Arg[0] = Owned To Guaranteed, Arg[1] = Owned To Guaranteed> of closure #1 (__ObjC.NSAnimationContext) -> () in macOS_swift.Window.endAnimation(__C.CGRect) -> () + 152
frame #2: 0x00000001001333a6 mpv`partial apply forwarder for closure #1 (__ObjC.NSAnimationContext) -> () in macOS_swift.Window.endAnimation(__C.CGRect) -> () + 86
frame #3: 0x00007fff4c836985 AppKit`+[NSAnimationContext runAnimationGroup:] + 55
frame #4: 0x00000001000fa4f9 mpv`macOS_swift.Window.endAnimation(__C.CGRect) -> () + 377
frame #5: 0x00000001000f9fed mpv`macOS_swift.Window.windowDidEnterFullScreen(Foundation.Notification) -> () + 269
frame #6: 0x00000001000fa2dd mpv`@objc macOS_swift.Window.windowDidEnterFullScreen(Foundation.Notification) -> () with unmangled suffix "_merged" + 61
frame #7: 0x00007fff4e926edc CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
frame #8: 0x00007fff4e926daa CoreFoundation`_CFXRegistrationPost + 458
frame #9: 0x00007fff4e926ae1 CoreFoundation`___CFXNotificationPost_block_invoke + 225
frame #10: 0x00007fff4e8e4880 CoreFoundation`-[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1664
frame #11: 0x00007fff4e8e39b7 CoreFoundation`_CFXNotificationPost + 599
frame #12: 0x00007fff509f38c7 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 66
frame #13: 0x00007fff4ca26c99 AppKit`-[NSWindow(NSFullScreen) _didEnterFullScreen] + 118
frame #14: 0x00007fff4c3852ca AppKit`-[_NSWindowEnterFullScreenTransitionController doAfterEnterFullScreen] + 65
frame #15: 0x00007fff4c854dd3 AppKit`-[_NSEnterFullScreenTransitionController _performFinalTransitionCleanup] + 68
frame #16: 0x00007fff4c8567ba AppKit`___NSMainRunLoopPerformBlockAfterDelay_block_invoke + 25
frame #17: 0x00007fff4e91b014 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
frame #18: 0x00007fff4e91ac87 CoreFoundation`__CFRunLoopDoTimer + 1095
frame #19: 0x00007fff4e91a78a CoreFoundation`__CFRunLoopDoTimers + 346
frame #20: 0x00007fff4e911d5b CoreFoundation`__CFRunLoopRun + 2427
frame #21: 0x00007fff4e911153 CoreFoundation`CFRunLoopRunSpecific + 483
frame #22: 0x00007fff4dbfbd96 HIToolbox`RunCurrentEventLoopInMode + 286
frame #23: 0x00007fff4dbfbb06 HIToolbox`ReceiveNextEventCommon + 613
frame #24: 0x00007fff4dbfb884 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 64
frame #25: 0x00007fff4beaca73 AppKit`_DPSNextEvent + 2085
frame #26: 0x00007fff4c642e34 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 3044
frame #27: 0x00007fff4bea1885 AppKit`-[NSApplication run] + 764
frame #28: 0x00000001000ea204 mpv`cocoa_main + 1060
frame #29: 0x00007fff76752015 libdyld.dylib`start + 1
frame #30: 0x00007fff76752015 libdyld.dylib`start + 1
it's possible that this was fixed with one of the various open PRs from me. maybe this one #5928?
I'm guessing there is a race condition somewhere because it only fails sometimes. Can the functions in window.swift be invoked from more than one thread?
a generalised questions like that can't be answered, there are about 40 functions that all do something else. most window functions should only be called and are called from the main thread, since cocoa expects anything that changes the UI to be called from it.
for me mpv never crashed at the end of the fullscreen animation. maybe it's caused by something in your your config?
I can replicate this as well. Start playing any video, hit f a couple times, and it crashes.
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: exc handler [0]
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 io.mpv 0x0000000109d1e559 specialized closure #1 in Window.endAnimation(_:) + 441
1 io.mpv 0x0000000109d213a6 partial apply for closure #1 in Window.endAnimation(_:) + 86
2 com.apple.AppKit 0x00007fff430d2985 +[NSAnimationContext runAnimationGroup:] + 55
3 io.mpv 0x0000000109ce84f9 Window.endAnimation(_:) + 377
4 io.mpv 0x0000000109ce7fed Window.windowDidEnterFullScreen(_:) + 269
5 io.mpv 0x0000000109ce82dd @objc Window.windowDidEnterFullScreen(_:) + 61
6 com.apple.CoreFoundation 0x00007fff451c2edc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
7 com.apple.CoreFoundation 0x00007fff451c2daa _CFXRegistrationPost + 458
8 com.apple.CoreFoundation 0x00007fff451c2ae1 ___CFXNotificationPost_block_invoke + 225
9 com.apple.CoreFoundation 0x00007fff45180880 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1664
10 com.apple.CoreFoundation 0x00007fff4517f9b7 _CFXNotificationPost + 599
11 com.apple.Foundation 0x00007fff4728f8c7 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
12 com.apple.AppKit 0x00007fff432c2c99 -[NSWindow(NSFullScreen) _didEnterFullScreen] + 118
13 com.apple.AppKit 0x00007fff42c212ca -[_NSWindowEnterFullScreenTransitionController doAfterEnterFullScreen] + 65
14 com.apple.AppKit 0x00007fff430f0dd3 -[_NSEnterFullScreenTransitionController _performFinalTransitionCleanup] + 68
15 com.apple.AppKit 0x00007fff430f27ba ___NSMainRunLoopPerformBlockAfterDelay_block_invoke + 25
16 com.apple.CoreFoundation 0x00007fff451b7014 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
17 com.apple.CoreFoundation 0x00007fff451b6c87 __CFRunLoopDoTimer + 1095
18 com.apple.CoreFoundation 0x00007fff451b678a __CFRunLoopDoTimers + 346
19 com.apple.CoreFoundation 0x00007fff451add5b __CFRunLoopRun + 2427
20 com.apple.CoreFoundation 0x00007fff451ad153 CFRunLoopRunSpecific + 483
21 com.apple.HIToolbox 0x00007fff44497d96 RunCurrentEventLoopInMode + 286
22 com.apple.HIToolbox 0x00007fff44497b06 ReceiveNextEventCommon + 613
23 com.apple.HIToolbox 0x00007fff44497884 _BlockUntilNextEventMatchingListInModeWithFilter + 64
24 com.apple.AppKit 0x00007fff42748a73 _DPSNextEvent + 2085
25 com.apple.AppKit 0x00007fff42edee34 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 3044
26 com.apple.AppKit 0x00007fff4273d885 -[NSApplication run] + 764
27 io.mpv 0x0000000109cd8204 cocoa_main + 1060
28 libdyld.dylib 0x00007fff6cfee015 start + 1
i can confirm this issue when using the binary from brew cask install mpv. though i can't reproduce the issue with my own build. i would assume this is a problem with the way that binary was build. fastest way to solve this is probably when the person behind https://laboratory.stolendata.net/~djinn/mpv_osx/ would poke me to find the issue in his build setup.
the problem might be that he builds with CFLAGS="-mmacosx-version-min=10.9" but the swift parts are build with -target x86_64-apple-macosx10.10 (the oldest version supported by the new swift code), which leads to a mismatch.
or it's just #5585 since he builds on 10.11 and latest sdk/swift version there supposedly has a bug. maybe just --disable-optimize helps in that case.
@Akemi @pxia I can make a new build with a minimum target of 10.10 if you'd be willing to give that a try. For what it's worth, I cannot replicate this problem on my official build when I run it on 10.11.6 and 10.12.6.
Sure I'm happy to test it. Also where can I see your script building the app bundle?
sure.
@Akemi @pxia
Give https://laboratory.stolendata.net/~djinn/mpv-0.29.0-depl_trgt_1010.tar.gz a try - this is built on 10.12.6 with 10.10 as target. I cannot replicate the crash with this build either.
My somewhat rough build process: https://gist.github.com/stolendata/07aad5e68bfed5e7f1a5ffaf793ffff8
@stolendata I was having the same issue on your 0.29.0 build, and the new build does not seem to crash any more on toggling fullscreen.
My OS version is 10.13.5 btw.
this was a bit of a pain in the ass to test. i can only reproduce the crash once, maximal twice, per restart with the bundle. then it always happens immediately the first or second time after entering or leaving fs.
i was unable to reproduce the crash with your new bundle after a few restarts. so i would assume it is fixed, since @pxia and @wynnsyt also confirmed it.
@stolendata as a reference for me. this was built with the newest toolchain right, eg swift 4.x and SDK 10.13? asking since i am planning to scrap swift 3 support because of that bug.
@Akemi I don't have 10.13-capable hardware; it's built on 10.12, which comes with 10.13 SDK and Swift 4.0.
@stolendata Anything that can run macOS 10.12 (Sierra) can run macOS 10.13 (High Sierra), the new hardware cut-off is macOS 10.14 (Mojave) which requires Metal support.
https://en.wikipedia.org/wiki/MacOS_High_Sierra#System_requirements
Same requirements as macOS 10.12 (Sierra)
So shall we update the cask with the minimum target of 10.10 version?
I asked a few people running 10.3 to also test and no one managed to replicate the problem with my new build. I feel confident enough it's stable so I've updated what I make available on my website.
@Cpuroast I have a 2009 MBP, officially not supported by Sierra and later (but installable with some effort).
closing since it's a duplicate of #5585. i will close #5585 when i drop support for swift 3.
Most helpful comment
@stolendata I was having the same issue on your 0.29.0 build, and the new build does not seem to crash any more on toggling fullscreen.
My OS version is 10.13.5 btw.