mpvkit / MPVKit

mpv library for iOS, macOS, tvOS applications
GNU Lesser General Public License v3.0
25 stars 9 forks source link

macOS: LuaJIT crashes MPV player with v0.38.0 #9

Closed stonerl closed 2 weeks ago

stonerl commented 2 weeks ago

We are using MPVKit in the Yattee Project.

We had macOS users complaining about Yattee crashing when using MPV; see this issue (ignore the startup crash comments, that one has been fixed).

I was able to nail it down to LuaJIT. Since macOS is the only platform that uses LuaJIT, tvOS and iOS are not affected.

Ping @arekf

stonerl commented 2 weeks ago

Some additional information:

Thread 15 Crashed:: */ytdl_hook
0   Yattee                                 0x10268761c lj_vmeta_tsetv + 48
1   Yattee                                 0x102685764 lj_BC_LEN + 68
2   Yattee                                 0x102653aec load_builtin + 428
3   Yattee                                 0x10268709c lj_BC_FUNCC + 44
4   Yattee                                 0x1026e9614 lj_cf_package_require + 472
5   Yattee                                 0x102656afc require + 180
6   Yattee                                 0x102653df4 load_scripts + 96
7   Yattee                                 0x10268709c lj_BC_FUNCC + 44
8   Yattee                                 0x10269db0c lua_pcall + 148
9   Yattee                                 0x10268709c lj_BC_FUNCC + 44
10  Yattee                                 0x10269db4c lua_cpcall + 28
11  Yattee                                 0x1025fc880 run_script + 92
12  Yattee                                 0x1025fc8d4 script_thread + 12
13  libsystem_pthread.dylib                0x18a7c32e4 _pthread_start + 136
14  libsystem_pthread.dylib                0x18a7be0fc thread_start + 8

Thread 16:
0   libsystem_pthread.dylib                0x18a7be0f4 thread_start + 0

Thread 17:: */console
0   Yattee                                 0x10268a648 gc_traverse_func + 236
1   Yattee                                 0x1026a8f10 luaL_loadbuffer + 84
2   Yattee                                 0x10268709c lj_BC_FUNCC + 44
3   Yattee                                 0x1026e9614 lj_cf_package_require + 472
4   Yattee                                 0x102656afc require + 180
5   Yattee                                 0x102653df4 load_scripts + 96
6   Yattee                                 0x10268709c lj_BC_FUNCC + 44
7   Yattee                                 0x10269db0c lua_pcall + 148
8   Yattee                                 0x10268709c lj_BC_FUNCC + 44
9   Yattee                                 0x10269db4c lua_cpcall + 28
10  Yattee                                 0x1025fc880 run_script + 92
11  Yattee                                 0x1025fc8d4 script_thread + 12
12  libsystem_pthread.dylib                0x18a7c32e4 _pthread_start + 136
13  libsystem_pthread.dylib                0x18a7be0fc thread_start + 8
cxfksword commented 2 weeks ago

It seems to be caused by mpv ytdl. If you don't use this feature, you can try to disable it:

mpv_set_option_string(mpv, "ytdl", "no")
stonerl commented 2 weeks ago

thx. That did the trick.