-
Notifications
You must be signed in to change notification settings - Fork 70
Description
Summary
When using MpvRenderContext (the OpenGL render API) on Windows with the standard libmpv-2.dll build (which includes LuaJIT), the application crashes with SEH exception code 0xe24c4a02.
Environment
- Windows 10/11 x64
- python-mpv (latest)
- Standard
libmpv-2.dllfrom mpv-winbuild-cmake releases
What happens
0xe24c4a02 is LuaJIT's Windows x64 SEH code — it fires during normal Lua error propagation in mpv's event thread. Normally LuaJIT's own __try/__except frame catches it, but when the mpv event loop is running alongside a Python application, the exception can escape into Python territory and faulthandler terminates the process.
This is not caused by user Lua scripts. Setting load_scripts=False does not help because LuaJIT is compiled into mpv core and its SEH exceptions fire regardless.
The crash happens reliably when:
- Switching between videos repeatedly (each switch tears down and recreates
MpvRenderContext) - Opening multiple windows with independent
MPV()instances simultaneously
Fix
Build libmpv from source with -Dlua=disabled -Djavascript=disabled. This completely removes LuaJIT from the binary and eliminates the crashes entirely.
# Using MSYS2 on Windows
meson setup build --prefix=/mingw64 \
-Dlibmpv=true \
-Dlua=disabled \
-Djavascript=disabled \
-Dcplayer=false \
-Dbuildtype=release
ninja -C build libmpv-2.dllNote: with a no-Lua build, the osc, load_console, load_stats_overlay, load_select, load_context_menu, and load_positioning MPV options do not exist and will raise AttributeError if passed to mpv.MPV(). Remove them from your init call.
Workaround
If you cannot rebuild, a Vectored Exception Handler (VEH) does not work — 0xe24c4a02 is a non-continuable exception from LuaJIT's perspective. The only reliable fix is a no-Lua build.
Suggestion
It would be helpful to document this in the README for Windows users, and/or add a note that the standard shinchiro builds include LuaJIT which can cause this crash in embedding scenarios.