Mpv: mp.observe_property() causes "Illegal instruction: 4" in macOS

Created on 11 Feb 2019  ·  13Comments  ·  Source: mpv-player/mpv

mpv version and platform

mpv 0.29.1 built on Fri Oct 5 00:01:23 CEST 2018
ffmpeg library versions:
libavutil 56.14.100
libavcodec 56.14.100
libavformat 56.14.100
libswscale 5.1.100
libavfilter 7.16.100
libswresample 3.1.100
ffmpeg version: 4.0.2

macOS Mojave 10.14.3

Reproduction steps

  1. Use an empty $HOME/.config/mpv directory, so the default configuration is used. It happens with my personal configuration too, but this way the logs are cleaner.
  2. Create $HOME/.config/mpv/scripts directory
  3. Put pause-when-minimize.lua in $HOME/.config/mpv/scripts, even though the problem arises with just a simple LUA script containing any mp.observe_property() call.
  4. Launch mpv with any video (I've tested many of them, with various formats), by hand, from a terminal window.

Expected behavior

The video should start playing and it should pause automatically when the window is minimized.

Actual behavior

The video doesn't even start playing, mpv crashes with Illegal instruction: 4 error.

Log file

Here you have it, at null pointer.

Sample files

I'm using the github version of the LUA script, which you can find here.

Thanks a lot in advance and feel free to ask me for any other information you may need.

mac

Most helpful comment

6491 will fix the minimising bug and also properly reports the window state now. i can only reproduce this crash with the 'window-minimized' property. if any other properties are affected too please let me know, since from a quick test only that one property was a problem.

All 13 comments

I have the same problem with mp.observe_property('window-minimized'....). Opening a file while MPV is not running causes immediate crash. Opening a file while MPV is already running doesn't crash but the script also doesn't work.

Script: https://github.com/deus0ww/mpv-conf/blob/master/scripts/Mac_Integration.lua (the part that's commented out).

I have no problem with other mp.observe_property(...). This is on macOS 10.13.6 (17G5019), MacBook Pro 2012, on today's git HEAD + LuaJIT 2.1 HEAD.

Crashed Thread: 28 mpv/vo

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 28 Crashed:: mpv/vo
0 io.mpv 0x000000010b95fb17 $S11macOS_swift7CocoaCBC15controlCallbackys5Int32VSpySo2voVGSg_SvSgSpyAFGSgs6UInt32VAKtXCvpfiAfJ_AkmoKtcfU_ + 2823
1 io.mpv 0x000000010b95fb99 $S11macOS_swift7CocoaCBC15controlCallbackys5Int32VSpySo2voVGSg_SvSgSpyAFGSgs6UInt32VAKtXCvpfiAfJ_AkmoKtcfU_To + 9
2 io.mpv 0x000000010b93a6ae control + 270
3 io.mpv 0x000000010b9362b4 run_control + 52
4 io.mpv 0x000000010b8af8f3 mp_dispatch_queue_process + 259
5 io.mpv 0x000000010b938781 vo_thread + 1505
6 libsystem_pthread.dylib 0x00007fff7c622661 _pthread_body + 340
7 libsystem_pthread.dylib 0x00007fff7c62250d _pthread_start + 377
8 libsystem_pthread.dylib 0x00007fff7c621bf9 thread_start + 13

Behavior of mp.observe_property('window-minimized', 'native', function(_, minimized)....

With vo=libmpv

  • If MPV was already running:

    • doesn't crash

    • doesn't work (doesn't trigger at all)

  • If MPV was not running

    • crash on launch

With vo=gpu

  • Working as expected

Thanks, @deus0ww, for confirming. I have to repeat all my tests, then, because when I did them I could reproduce the problem with any property, not only with window-minimized. Anyway, it crashes with that property anyway, so...

Behavior of mp.observe_property('window-minimized', 'native', function(_, minimized)....

With vo=libmpv

  • If MPV was already running:

    • doesn't crash
    • doesn't work (doesn't trigger at all)
  • If MPV was not running

    • crash on launch

With vo=gpu

  • Working as expected

@deus0ww I just tested this and I can confirm it on a MacBook Air (2014) running Mojave.

6491 will fix the minimising bug and also properly reports the window state now. i can only reproduce this crash with the 'window-minimized' property. if any other properties are affected too please let me know, since from a quick test only that one property was a problem.

6491 will fix the minimising bug and also properly reports the window state now. i can only reproduce the this crash with the 'window-minimized' property. if any other properties are affected too please let me know, since from a quick test only that one property was a problem.

@Akemi, I repeated some of the tests I originally made and, so far, the only property causing the problem is window-minimized 🤷‍♂️ I don't know why others failed before, maybe the reason why only this one fails now is that I updated macOS yesterday, who knows.

If any other property fails for me I'll report it.

And thanks A LOT for the fix!!!

I can confirm that the PR fixes this. Thank you, @Akemi!

I'm still seeing "Illegal instruction: 4" crashes after applying the PR. In my case, I have a Lua script that removes images from the current playlist (since mpv started playing images at some point and I can't get it to stop, which is a pain when playing albums with cover art files). When an image comes up in the playlist and gets skipped, the next file will cause the crash.

This zip contains a jpg, an mp3, and the image.lua script: https://0x0.st/zPHm.zip
Add image.lua to mpv's scripts and then play the jpg and mp3 in order.
Log: https://0x0.st/zPHB.txt
Crash: https://0x0.st/zPHu.crash

This appears separate from https://github.com/mpv-player/mpv/issues/6191. Both types of crash disappeared for months after I recompiled with --disable-swift, but came back immediately when I recently removed that flag.

that is a separate issue and not related to this one, hence why it's not fixed by that PR. though the explanation here and on the PR should make that quite clear.

i am going to state the obvious. that crash is within the swift parts, hence why it won't crash without swift. i can reproduce that crash and will fix it.

@Forcer78 your problem will be fixed with PR #6595.

After re-building, it seems --no-border also triggers the error/crash. Removed the setting on mine for now. On HEAD, macOS 10.14.4

fixed with #6595. all those errors are fixed for good with that PR.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings