moved from tech@ On 2018/06/23 13:44, Hiltjo Posthuma wrote: > On Fri, Mar 16, 2018 at 02:40:00PM +0100, Hiltjo Posthuma wrote: > > On Fri, Mar 16, 2018 at 02:29:24PM +0100, Hiltjo Posthuma wrote: > > > On Thu, Mar 15, 2018 at 03:27:47PM +0100, Martin Pieuchot wrote: > > > > On 05/03/18(Mon) 21:26, Hiltjo Posthuma wrote: > > > > > > [...] > > > > > > I tried your patch on a source build of about 25 februari on amd64. > > > > > > I still > > > > > > notice mpv hanging when I try to close it or when the video ends. > > > > > > > > Thanks for reporting. This is a different issue. > > > > > > > > > > Let me know how/if I can help you further with testing. > > > > > > > > Could you tell me how to reproduce the problem? > > > > > > > > > Updated to source of ~4 March: > > > > > > > > > > OpenBSD ren.laptop 6.3 GENERIC.MP#0 amd64 > > > > > > > > > > When I do a backtrace on the hanged mpv I get: > > > > > > > > > > > > > > > $ gdb mpv pid > > > > > $ bt > > > > > > > > Could you get the backtrace of all the threads? > > > > > > > > Something like: 'thr apply all bt' > > > > > > > > > #0 _thread_sys___thrsleep () at -:3 > > > > > #1 0x0000117420965ea4 in _sem_wait (sem=0x1174219ffc40, > > > > > tryonly=564132932, abstime=0x0, > > > > > delayed_cancel=0x11738fa402f0) at > > > > > /usr/src/lib/librthread/rthread_sem.c:74 > > > > > #2 0x00001174209650bf in pthread_join (thread=0x1174219ffc40, > > > > > retval=0x0) > > > > > at /usr/src/lib/librthread/rthread.c:304 > > > > > #3 0x00001173ec0a9d5b in SDL_WaitThread_REAL () from > > > > > /usr/local/lib/libSDL2.so.0.4 > > > > > #4 0x00001173ec05b64a in close_audio_device () from > > > > > /usr/local/lib/libSDL2.so.0.4 > > > > > #5 0x00001173ec05a1e2 in SDL_AudioQuit_REAL () from > > > > > /usr/local/lib/libSDL2.so.0.4 > > > > > #6 0x00001173ec05703b in SDL_QuitSubSystem_REAL () from > > > > > /usr/local/lib/libSDL2.so.0.4 > > > > > #7 0x000011713bf135e9 in ao_uninit (ao=0x11740b004740) at > > > > > ../audio/out/ao.c:336 > > > > > #8 0x000011713bf561fe in uninit_audio_out (mpctx=0x1173a2d8b840) at > > > > > ../player/audio.c:280 > > > > > #9 0x000011713bf6efd2 in mp_destroy (mpctx=0x1173a2d8b840) at > > > > > ../player/main.c:166 > > > > > #10 0x000011713bf6fbe1 in mpv_main (argc=Variable "argc" is not > > > > > available. > > > > > ) at ../player/main.c:243 > > > > > #11 0x000011713bf03156 in _start () from /usr/local/bin/mpv > > > > > #12 0x0000000000000000 in ?? () > > > > > (gdb) > > > > > > > > > > Hi, > > > > > > I rebuild base and xenocara from source yesterday and rebuild and > > > reinstalled > > > mpv. > > > > > > The hang always happens after a video ends. I've not had any issues with > > > other > > > programs I think. When the hang happens mpv doesn't response to SIGTERM, > > > so SIGKILL is needed. > > > > > > > To clarify a bit more: > > > > The hang (the mpv window doesn't respond anymore) >>when it happens<< always > > happens after a video ends so far. > > > > I'm not able to provide a test-case that reproduces it consistently yet. > > > > Hi, > > Is anyone using mpv also able to reproduce the hang issue? > > I have tried to study the libpthread and rthread code on -current, but it is > not my area of expertise. I think the issue happened before the recent futex > code changes also. > > Another issue (that might be related): > > The CPU usage is extremely high on mpv compared to ffplay or mplayer. With a > ktrace on a 10 second video it has 1.3million gettimeofday() calls. The mpv > port could be updated to detect it can use the clock_gettime(CLOCK_MONOTONIC, > ...). mplayer and ffplay don't use threads for waiting, so my guess it is > also > a threading issue. > > The version is ports is also about 2 years old and could use some love by the > maintainer.
I'm not seeing the hang, but I know why it's using gettimeofday, here's a patch to use clock_gettime instead. OK? Index: Makefile =================================================================== RCS file: /cvs/ports/multimedia/mpv/Makefile,v retrieving revision 1.39 diff -u -p -r1.39 Makefile --- Makefile 20 Jan 2018 11:42:59 -0000 1.39 +++ Makefile 23 Jun 2018 12:26:51 -0000 @@ -10,7 +10,7 @@ COMMENT = movie player based on MPlayer GH_ACCOUNT = mpv-player GH_PROJECT = mpv GH_TAGNAME = v0.22.0 -REVISION = 1 +REVISION = 2 CATEGORIES = multimedia x11 Index: patches/patch-osdep_timer-linux_c =================================================================== RCS file: patches/patch-osdep_timer-linux_c diff -N patches/patch-osdep_timer-linux_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-osdep_timer-linux_c 23 Jun 2018 12:26:51 -0000 @@ -0,0 +1,17 @@ +$OpenBSD$ + +OpenBSD doesn't define _POSIX_TIMERS because we are missing some of the +required clocks, but we do have enough for mpv. + +Index: osdep/timer-linux.c +--- osdep/timer-linux.c.orig ++++ osdep/timer-linux.c +@@ -19,6 +19,8 @@ + */ + + #include <unistd.h> ++#undef _POSIX_TIMERS ++#define _POSIX_TIMERS 1 + #include <stdlib.h> + #include <time.h> + #include <sys/time.h> Index: patches/patch-osdep_timer_c =================================================================== RCS file: patches/patch-osdep_timer_c diff -N patches/patch-osdep_timer_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-osdep_timer_c 23 Jun 2018 12:26:51 -0000 @@ -0,0 +1,17 @@ +$OpenBSD$ + +OpenBSD doesn't define _POSIX_TIMERS because we are missing some of the +required clocks, but we do have enough for mpv. + +Index: osdep/timer.c +--- osdep/timer.c.orig ++++ osdep/timer.c +@@ -19,6 +19,8 @@ + #include <pthread.h> + #include <time.h> + #include <unistd.h> ++#undef _POSIX_TIMERS ++#define _POSIX_TIMERS 1 + #include <sys/time.h> + #include <limits.h> + #include <assert.h> Index: patches/patch-stream_tvi_v4l2_c =================================================================== RCS file: patches/patch-stream_tvi_v4l2_c diff -N patches/patch-stream_tvi_v4l2_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-stream_tvi_v4l2_c 23 Jun 2018 12:26:51 -0000 @@ -0,0 +1,17 @@ +$OpenBSD$ + +OpenBSD doesn't define _POSIX_TIMERS because we are missing some of the +required clocks, but we do have enough for mpv. + +Index: stream/tvi_v4l2.c +--- stream/tvi_v4l2.c.orig ++++ stream/tvi_v4l2.c +@@ -44,6 +44,8 @@ known issues: + #include <sys/time.h> + #include <sys/types.h> + #include <unistd.h> ++#undef _POSIX_TIMERS ++#define _POSIX_TIMERS 1 + #include <math.h> + #if HAVE_SYS_VIDEOIO_H + #include <sys/videoio.h>
