TheCactusVert / mpv-sponsorblock

MPV plugin that allow you to skip sponsors while watching YouTube videos
MIT License
45 stars 4 forks source link

illegal hardware instruction (core dumped) #21

Closed YoureMySoul closed 2 weeks ago

YoureMySoul commented 3 weeks ago

minimal reproduction:

mpv --config=no --force-window --idle --script=./target/release/libmpv_sponsorblock.so

Description

When mpv starts without any video input, it crashes. However, everything works fine as long as there is a video input.

System

mpv v0.38.0 Archlinux

JohnTheCoolingFan commented 3 weeks ago

Same issue, on Celluloid. When a video finishes, the player crashes. But launching without a video doesn't crash. I don't really watch youtube videos this way anymore, but I would like to help diagnosing and resolving this issue.

[40177.609304] traps: cplugin/sponsor[65953] trap invalid opcode ip:7f0c4c2bc017 sp:7f0c2a7faab0 error:0 in sponsorblock.so[7f0c4c258000+2b5000]
[46957.972344] traps: cplugin/sponsor[68483] trap invalid opcode ip:7f28ac2bc017 sp:7f286d7f8ab0 error:0 in sponsorblock.so[7f28ac258000+2b5000]
[47147.967576] traps: cplugin/sponsor[79824] trap invalid opcode ip:7f0848ab6d17 sp:7f08497f8ad0 error:0 in sponsorblock.so[7f0848a54000+298000]

Along with the locally-built binary: libmpv_sponsorblock.zip

TheCactusVert commented 2 weeks ago

I took a look at the binary you gave me and it seems you have built it with the nightly toolchain. I could reproduce the crash when building with the nightly toolchain. Can you both try building the binary with the stable toolchain please?

JohnTheCoolingFan commented 2 weeks ago

I've built my binary using stable toolchain. The project does not override the toolchain used and my toolchain is set to stable by default.

JohnTheCoolingFan commented 2 weeks ago

Using command cargo +stable build --release --locked to ensure this is stable:

[12192.580821] traps: cplugin/sponsor[39211] trap invalid opcode ip:7f58e42b6d17 sp:7f58b57f8ad0 error:0 in sponsorblock.so[7f58e4254000+298000]

libmpv_sponsorblock.zip

TheCactusVert commented 2 weeks ago

My mistake you built it with rustc version 1.80.1 (3f5fd8dd4 2024-08-06). I was testing on an old build with rustc version 1.77.2, it seems to work fine on this version of the compiler. I tried in 1.80.1 and the crash happens. I'm going to take a look.

JohnTheCoolingFan commented 2 weeks ago

Yes, I used 1.80.1, the current rust stable

rustc 1.80.1 (3f5fd8dd4 2024-08-06)
cargo 1.80.1 (376290515 2024-07-16)
TheCactusVert commented 2 weeks ago

Can you try to build this branch : https://github.com/TheCactusVert/mpv-sponsorblock/tree/crash_no_video I found the problem it's in the way rust handle enum. I should rewrite mpv-client and use someting like rust-bindgen to generate the bindings.

JohnTheCoolingFan commented 2 weeks ago

Yes, that branch fixes it!

TheCactusVert commented 2 weeks ago

Thanks for your help! I'm going to rework a lot of things for the next release.

YoureMySoul commented 2 weeks ago

Thank you so much for the quick fix. It's working now.