forked from mpv-player/mpv
-
Notifications
You must be signed in to change notification settings - Fork 0
Playground #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kasper93
wants to merge
3
commits into
master
Choose a base branch
from
gha
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Playground #1
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Download the artifacts for this pull request: |
e0c4818
to
a16f653
Compare
kasper93
added a commit
that referenced
this pull request
Apr 2, 2025
Clients run in detached threads and are waited to signal when they are finished with self mpv_destroy() call. Problem is that after detached thread calls this function, mpv consider this client to be done and can do whatever. One example is when mpv exits and wait for scripts to finish we got race condition, because mpv (main thread) can exit first and the detached thread calls ta_free() which crashes, because we are we may already destoryed things that the thread depends on. I've seen this crash in FreeBSD CI job (libmpv-lifetime test), where the libmpv.so has been unloaded while the thread was still doing ta_free() ==5081==ERROR: AddressSanitizer: SEGV on unknoun address 0x000001111806 (pc 0x000001111806 bp 0x7fffdedf4e40 sp 0x7fffdedf4e08 T40) ==5081==The signal is caused by a READ memory access. #0 0x1111806 (<unknown module>) #1 0x803cd6900 in ta_free /home/runner/work/mpv/mpv/build/../ta/ta.c:243:5 #2 0x803a2fc87 in run_script /home/runner/work/mpv/mpv/build/../player/scripting.c:93:5 mpv-player#3 0x803a2ffe0 in script_thread /home/runner/work/mpv/mpv/build/../player/scripting.c:99:5 mpv-player#4 0x2c451a in asan_thread_start(void*) /usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:239:28 mpv-player#5 0x80034fb04 (/lib/libthr.so.3+0x10b04) Note the 0x1111806 jump which is completelly bogus. Fix this by doing mpv_destroy() as a last step in detached threads.
kasper93
added a commit
that referenced
this pull request
Apr 2, 2025
Clients run in detached threads and are waited to signal when they are finished with self mpv_destroy() call. Problem is that after detached thread calls this function, mpv consider this client to be done and can do whatever. One example is when mpv exits and wait for scripts to finish we got race condition, because mpv (main thread) can exit first and the detached thread calls ta_free() which crashes, because we are we may already destoryed things that the thread depends on. I've seen this crash in FreeBSD CI job (libmpv-lifetime test), where the libmpv.so has been unloaded while the thread was still doing ta_free() ``` ==5081==ERROR: AddressSanitizer: SEGV on unknoun address 0x000001111806 (pc 0x000001111806 bp 0x7fffdedf4e40 sp 0x7fffdedf4e08 T40) ==5081==The signal is caused by a READ memory access. #0 0x1111806 (<unknown module>) #1 0x803cd6900 in ta_free /home/runner/work/mpv/mpv/build/../ta/ta.c:243:5 #2 0x803a2fc87 in run_script /home/runner/work/mpv/mpv/build/../player/scripting.c:93:5 mpv-player#3 0x803a2ffe0 in script_thread /home/runner/work/mpv/mpv/build/../player/scripting.c:99:5 mpv-player#4 0x2c451a in asan_thread_start(void*) /usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:239:28 mpv-player#5 0x80034fb04 (/lib/libthr.so.3+0x10b04) ``` Note the 0x1111806 jump which is completelly bogus. Fix this by doing mpv_destroy() as a last step in detached threads.
kasper93
added a commit
that referenced
this pull request
Apr 2, 2025
Clients run in detached threads and are waited to signal when they are finished with self mpv_destroy() call. Problem is that after detached thread calls this function, mpv consider this client to be done and can do whatever. One example is when mpv exits and wait for scripts to finish we got race condition, because mpv (main thread) can exit first and the detached thread calls ta_free() which crashes, because we may have already destroyed things that the thread depends on. I've seen this crash on FreeBSD CI job (libmpv-lifetime test), where the libmpv.so has been unloaded while the thread was still doing ta_free() ``` ==5081==ERROR: AddressSanitizer: SEGV on unknoun address 0x000001111806 (pc 0x000001111806 bp 0x7fffdedf4e40 sp 0x7fffdedf4e08 T40) ==5081==The signal is caused by a READ memory access. #0 0x1111806 (<unknown module>) #1 0x803cd6900 in ta_free /home/runner/work/mpv/mpv/build/../ta/ta.c:243:5 #2 0x803a2fc87 in run_script /home/runner/work/mpv/mpv/build/../player/scripting.c:93:5 mpv-player#3 0x803a2ffe0 in script_thread /home/runner/work/mpv/mpv/build/../player/scripting.c:99:5 mpv-player#4 0x2c451a in asan_thread_start(void*) /usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:239:28 mpv-player#5 0x80034fb04 (/lib/libthr.so.3+0x10b04) ``` Note the 0x1111806 jump which is completelly bogus. Fix this by doing mpv_destroy() as a last step in detached threads.
kasper93
added a commit
that referenced
this pull request
Apr 3, 2025
Clients run in detached threads and are waited to signal when they are finished with self mpv_destroy() call. Problem is that after detached thread calls this function, mpv consider this client to be done and can do whatever. One example is when mpv exits and wait for scripts to finish we got race condition, because mpv (main thread) can exit first and the detached thread calls ta_free() which crashes, because we may have already destroyed things that the thread depends on. I've seen this crash on FreeBSD CI job (libmpv-lifetime test), where the libmpv.so has been unloaded while the thread was still doing ta_free() ``` ==5081==ERROR: AddressSanitizer: SEGV on unknoun address 0x000001111806 (pc 0x000001111806 bp 0x7fffdedf4e40 sp 0x7fffdedf4e08 T40) ==5081==The signal is caused by a READ memory access. #0 0x1111806 (<unknown module>) #1 0x803cd6900 in ta_free /home/runner/work/mpv/mpv/build/../ta/ta.c:243:5 #2 0x803a2fc87 in run_script /home/runner/work/mpv/mpv/build/../player/scripting.c:93:5 mpv-player#3 0x803a2ffe0 in script_thread /home/runner/work/mpv/mpv/build/../player/scripting.c:99:5 mpv-player#4 0x2c451a in asan_thread_start(void*) /usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:239:28 mpv-player#5 0x80034fb04 (/lib/libthr.so.3+0x10b04) ``` Note the 0x1111806 jump which is completelly bogus. Fix this by doing mpv_destroy() as a last step in detached threads.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.