Skip to content
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

Playing a second video crashes the application #200

Closed
3 tasks done
jmc-88 opened this issue May 16, 2020 · 16 comments
Closed
3 tasks done

Playing a second video crashes the application #200

jmc-88 opened this issue May 16, 2020 · 16 comments

Comments

@jmc-88
Copy link

jmc-88 commented May 16, 2020

Prerequisites

  • I have searched open and closed issues for duplicates.

Describe the bug

Playing a second video crashes the application.

To Reproduce

Steps to reproduce the behavior:

  1. Play a video
  2. Replay the same video or play another one
  3. Boom

Expected behavior

The second video should play just fine.

Screenshots or screen recordings

N/A

Logs

Something funny is that running the application with G_MESSAGES_DEBUG=all seems to make the crash disappear.

** (io.elementary.videos:16180): CRITICAL **: 20:10:39.860: audience_objects_video_construct: assertion 'file != NULL' failed

** (io.elementary.videos:16180): CRITICAL **: 20:10:39.860: audience_library_page_add_item: assertion 'video != NULL' failed

** (io.elementary.videos:16180): CRITICAL **: 20:10:39.860: audience_objects_video_get_hash_file_poster: assertion 'self != NULL' failed

** (io.elementary.videos:16180): CRITICAL **: 20:10:39.860: audience_objects_video_get_hash_episode_poster: assertion 'self != NULL' failed
libGL error: failed to create drawable
libGL error: failed to create drawable

(io.elementary.videos:16180): Gdk-ERROR **: 20:10:44.561: The program 'io.elementary.videos' received an X Window System error.
This probably reflects a bug in the program.
The error was 'GLXBadContext'.
  (Details: serial 13210 error_code 170 request_code 155 (GLX) minor_code 26)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the GDK_SYNCHRONIZE environment
   variable to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
fish: “io.elementary.videos” terminated by signal SIGTRAP (Trace or breakpoint trap)

gdb backtrace:

Starting program: /usr/bin/io.elementary.videos 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe6f6e700 (LWP 18351)]
[New Thread 0x7fffe62fc700 (LWP 18352)]
[New Thread 0x7fffdd737700 (LWP 18353)]
[New Thread 0x7fffdcd29700 (LWP 18354)]
[New Thread 0x7fffd3a58700 (LWP 18355)]
[New Thread 0x7fffc7fff700 (LWP 18357)]
[New Thread 0x7fffc77fe700 (LWP 18358)]
[Thread 0x7fffd3a58700 (LWP 18355) exited]
[Thread 0x7fffc77fe700 (LWP 18358) exited]
[New Thread 0x7fffc77fe700 (LWP 18363)]
[New Thread 0x7fffd3a58700 (LWP 18365)]
[New Thread 0x7fffc6953700 (LWP 18366)]
[New Thread 0x7fffc6152700 (LWP 18367)]
[New Thread 0x7fffb7641700 (LWP 18368)]
[Thread 0x7fffb7641700 (LWP 18368) exited]
[New Thread 0x7fffb7641700 (LWP 18369)]
[New Thread 0x7fffb6e40700 (LWP 18370)]
[New Thread 0x7fffb663f700 (LWP 18371)]
[New Thread 0x7fffb5e3e700 (LWP 18372)]
[New Thread 0x7fffb563d700 (LWP 18373)]
[New Thread 0x7fff9b8d9700 (LWP 18374)]
[Thread 0x7fffc77fe700 (LWP 18363) exited]
[Thread 0x7fffb6e40700 (LWP 18370) exited]
[New Thread 0x7fffb6e40700 (LWP 18375)]
[New Thread 0x7fffc77fe700 (LWP 18376)]
[New Thread 0x7fff765c7700 (LWP 18377)]
[New Thread 0x7fff75dc6700 (LWP 18378)]
[New Thread 0x7fff755c5700 (LWP 18379)]
[New Thread 0x7fff74dc4700 (LWP 18380)]
[Thread 0x7fff74dc4700 (LWP 18380) exited]
[New Thread 0x7fff74dc4700 (LWP 18381)]
[New Thread 0x7fff67fff700 (LWP 18382)]
[New Thread 0x7fff677fe700 (LWP 18383)]
[New Thread 0x7fff66ffd700 (LWP 18384)]
[New Thread 0x7fff667fc700 (LWP 18385)]
[Thread 0x7fff67fff700 (LWP 18382) exited]
[New Thread 0x7fff67fff700 (LWP 18387)]
[New Thread 0x7fff65ffb700 (LWP 18388)]
[New Thread 0x7fff4bfff700 (LWP 18389)]
[Thread 0x7fff4bfff700 (LWP 18389) exited]
[New Thread 0x7fff4bfff700 (LWP 18391)]
[New Thread 0x7fff77978700 (LWP 18392)]
[Thread 0x7fff77978700 (LWP 18392) exited]
[Thread 0x7fff4bfff700 (LWP 18391) exited]
[New Thread 0x7fff77978700 (LWP 18393)]
[New Thread 0x7fff4bfff700 (LWP 18394)]
[New Thread 0x7fff77177700 (LWP 18395)]
[Thread 0x7fff77177700 (LWP 18395) exited]
[New Thread 0x7fff77177700 (LWP 18396)]
[New Thread 0x7fff49a8d700 (LWP 18397)]
[New Thread 0x7fff4928c700 (LWP 18398)]
[New Thread 0x7fff48a8b700 (LWP 18399)]
[New Thread 0x7fff33fff700 (LWP 18400)]
[Thread 0x7fff33fff700 (LWP 18400) exited]
[New Thread 0x7fff33fff700 (LWP 18401)]
[New Thread 0x7fff337fe700 (LWP 18402)]
[New Thread 0x7fff32ffd700 (LWP 18403)]
[New Thread 0x7fff327fc700 (LWP 18404)]
[New Thread 0x7fff31e7b700 (LWP 18405)]

Thread 1 "io.elementary.v" received signal SIGTRAP, Trace/breakpoint trap.
_g_log_abort (breakpoint=breakpoint@entry=1) at ../../../../glib/gmessages.c:583
583	../../../../glib/gmessages.c: No such file or directory.
#0  0x00007ffff5e55ea1 in _g_log_abort (breakpoint=breakpoint@entry=1) at ../../../../glib/gmessages.c:583
#1  0x00007ffff5e58819 in g_log_writer_default (log_level=6, 
    log_level@entry=G_LOG_LEVEL_ERROR, fields=fields@entry=0x7fffffffcef0, n_fields=n_fields@entry=6, user_data=user_data@entry=0x0) at ../../../../glib/gmessages.c:2735
#2  0x00007ffff5e56a8e in g_log_structured_array (log_level=G_LOG_LEVEL_ERROR, fields=0x7fffffffcef0, n_fields=6) at ../../../../glib/gmessages.c:1970
#3  0x00007ffff5e574ce in g_log_structured_standard (log_domain=log_domain@entry=0x7ffff725ae8e "Gdk", log_level=log_level@entry=G_LOG_LEVEL_ERROR, file=file@entry=0x7ffff7279670 "../../../../../gdk/x11/gdkdisplay-x11.c", line=line@entry=0x7ffff72790cf "2766", func=func@entry=0x7ffff7279d90 <__func__.74449> "_gdk_x11_display_error_event", message_format=message_format@entry=0x7ffff727a10b "%s") at ../../../../glib/gmessages.c:2027
#4  0x00007ffff721cc41 in _gdk_x11_display_error_event (display=display@entry=0x5555557c30e0 [GdkX11Display], error=error@entry=0x7fffffffd540)
    at ../../../../../gdk/x11/gdkdisplay-x11.c:2766
#5  0x00007ffff7229ac3 in gdk_x_error (xdisplay=0x5555557b3970, error=0x7fffffffd540) at ../../../../../gdk/x11/gdkmain-x11.c:307
#6  0x00007ffff69838fa in _XError () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#7  0x00007fffe4ff1c94 in __glXSendError (dpy=dpy@entry=0x5555557b3970, errorCode=errorCode@entry=0 '\000', resourceID=resourceID@entry=0, minorCode=minorCode@entry=26, coreX11error=coreX11error@entry=false) at ../src/glx/glx_error.c:62
#8  0x00007fffe4ff1b79 in MakeContextCurrent (dpy=0x5555557b3970, draw=96469367, read=96469367, gc_user=0x5555567dd2f0) at ../src/glx/glxcurrent.c:223
#9  0x00007fffe52361dd in InternalMakeCurrentVendor (dpy=dpy@entry=0x5555557b3970, draw=draw@entry=96469367, read=read@entry=96469367, ctxInfo=ctxInfo@entry=0x5555565aab50, callerOpcode=<optimized out>, threadState=threadState@entry=0x555555bba860, vendor=0x555555958200) at ../../../src/GLX/libglx.c:823
#10 0x00007fffe5237f82 in CommonMakeCurrent (dpy=0x5555557b3970, draw=96469367, read=96469367, context=<optimized out>, callerOpcode=<optimized out>)
    at ../../../src/GLX/libglx.c:1005
#11 0x00007fffc5292c10 in destroy_objects (texture=0x5555562688a0) at ../../../../gst-libs/gst/vaapi/gstvaapitexture_glx.c:87
#12 0x00007fffc5292c10 in destroy_texture_unlocked (texture=0x5555562688a0) at ../../../../gst-libs/gst/vaapi/gstvaapitexture_glx.c:111
#13 0x00007fffc5292c10 in gst_vaapi_texture_glx_destroy (texture=0x5555562688a0) at ../../../../gst-libs/gst/vaapi/gstvaapitexture_glx.c:124
#14 0x00007fffc5247b62 in gst_vaapi_object_finalize (object=0x5555562688a0) at ../../../../gst-libs/gst/vaapi/gstvaapiobject.c:50
#15 0x00007fffc52479ae in gst_vaapi_mini_object_free (object=0x5555562688a0) at ../../../../gst-libs/gst/vaapi/gstvaapiminiobject.c:39
#16 0x00007fffc5247b48 in gst_vaapi_mini_object_unref_internal (object=<optimized out>) at ../../../../gst-libs/gst/vaapi/gstvaapiminiobject.h:202
#17 0x00007fffc5247b48 in gst_vaapi_mini_object_replace (old_object_ptr=<optimized out>, new_object=<optimized out>)
    at ../../../../gst-libs/gst/vaapi/gstvaapiminiobject.c:173
#18 0x00007fffc524bc85 in gst_vaapi_object_replace_internal (new_object=<optimized out>, old_object_ptr=<optimized out>)
    at ../../../../gst-libs/gst/vaapi/gstvaapiobject_priv.h:215
#19 0x00007fffc524bc85 in gst_vaapi_texture_replace (old_texture_ptr=<optimized out>, new_texture=<optimized out>) at ../../../../gst-libs/gst/vaapi/gstvaapitexture.c:203
#20 0x00007fffc52280a0 in meta_texture_free (meta=0x7fff5806b2c0) at ../../../gst/vaapi/gstvaapivideometa_texture.c:128
#21 0x00007ffff63ab8be in _gst_buffer_free (buffer=0x7fffbc08c0e0) at gstbuffer.c:734
#22 0x00007ffff63b0cd2 in default_stop (pool=0x7fffb0079240 [GstVaapiVideoBufferPool]) at gstbufferpool.c:414
#23 0x00007ffff63b0720 in do_stop (pool=pool@entry=0x7fffb0079240 [GstVaapiVideoBufferPool]) at gstbufferpool.c:432
#24 0x00007ffff63b26b8 in dec_outstanding (pool=0x7fffb0079240 [GstVaapiVideoBufferPool]) at gstbufferpool.c:1201
#25 0x00007ffff63b26b8 in gst_buffer_pool_release_buffer (pool=0x7fffb0079240 [GstVaapiVideoBufferPool], buffer=0x7fffbc08c0e0) at gstbufferpool.c:1364
#26 0x00007ffff63ab9f3 in _gst_buffer_dispose (buffer=0x7fffbc08c0e0) at gstbuffer.c:711
#27 0x00007ffff63e0a1c in gst_mini_object_unref (mini_object=0x7fffbc08c0e0) at gstminiobject.c:449
#28 0x00007ffff3f13c68 in _cogl_object_default_unref (object=0x5555567cde60) at cogl-object.c:85
#29 0x00007ffff3f29634 in _cogl_pipeline_layer_free (layer=0x555555f96240) at cogl-pipeline-layer.c:739
#30 0x00007ffff3f29634 in _cogl_object_pipeline_layer_indirect_free (obj=0x555555f96240) at cogl-pipeline-layer.c:60
#31 0x00007ffff5e4c5ed in g_list_foreach (list=<optimized out>, func=0x7ffff3f13a90 <cogl_object_unref>, user_data=user_data@entry=0x0) at ../../../../glib/glist.c:1011
#32 0x00007ffff3f26017 in _cogl_pipeline_free (pipeline=0x5555565a6820) at cogl-pipeline.c:500
#33 0x00007ffff3f26017 in _cogl_object_pipeline_indirect_free (obj=0x5555565a6820) at cogl-pipeline.c:98
#34 0x00007ffff3f25958 in _cogl_pipeline_node_unparent_real (node=node@entry=0x5555562ca0f0) at cogl-node.c:94
#35 0x00007ffff3f25eb8 in _cogl_pipeline_unparent (pipeline=0x5555562ca0f0) at cogl-pipeline.c:245
#36 0x00007ffff3f25eb8 in _cogl_pipeline_free (pipeline=0x5555562ca0f0) at cogl-pipeline.c:474
#37 0x00007ffff3f25eb8 in _cogl_object_pipeline_indirect_free (obj=0x5555562ca0f0) at cogl-pipeline.c:98
#38 0x00007ffff7bba087 in clutter_gst_frame_free (data=0x555555a05740) at clutter-gst-types.c:66
#39 0x00007ffff61291bb in g_boxed_free (boxed_type=93825003023792, boxed=0x555555a05740) at ../../../../gobject/gboxed.c:401
#40 0x00007ffff7bc486a in update_frame (self=self@entry=0x555555fe56b0 [ClutterGstAspectratio], new_frame=<optimized out>) at clutter-gst-content.c:166
#41 0x00007ffff7bc48b4 in _new_frame_from_pipeline (sink=<optimized out>, self=0x555555fe56b0 [ClutterGstAspectratio]) at clutter-gst-content.c:188
#45 0x00007ffff614712f in <emit signal ??? on instance 0x555555faf470 [ClutterGstVideoSink]> (instance=<optimized out>, signal_id=<optimized out>, detail=detail@entry=0)
    at ../../../../gobject/gsignal.c:3447
    #42 0x00007ffff612b10d in g_closure_invoke (closure=0x555555fe5840, return_value=0x0, n_param_values=1, param_values=0x7fffffffdc30, invocation_hint=0x7fffffffdbb0)
    at ../../../../gobject/gclosure.c:804
    #43 0x00007ffff613e05e in signal_emit_unlocked_R (node=node@entry=0x555555fb4670, detail=detail@entry=0, instance=instance@entry=0x555555faf470, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffffffdc30) at ../../../../gobject/gsignal.c:3635
    #44 0x00007ffff6146715 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fffffffddf0)
    at ../../../../gobject/gsignal.c:3391
#46 0x00007ffff7bc7695 in clutter_gst_source_dispatch (source=source@entry=0x555555813e00, callback=<optimized out>, user_data=<optimized out>)
    at clutter-gst-video-sink.c:2075
#47 0x00007ffff5e50417 in g_main_dispatch (context=0x5555557dd760) at ../../../../glib/gmain.c:3176
#48 0x00007ffff5e50417 in g_main_context_dispatch (context=context@entry=0x5555557dd760) at ../../../../glib/gmain.c:3829
#49 0x00007ffff5e50650 in g_main_context_iterate (context=context@entry=0x5555557dd760, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
    at ../../../../glib/gmain.c:3902
#50 0x00007ffff5e506dc in g_main_context_iteration (context=context@entry=0x5555557dd760, may_block=may_block@entry=1) at ../../../../glib/gmain.c:3963
#51 0x00007ffff7554efd in g_application_run (application=0x5555559e7320 [AudienceApp], argc=<optimized out>, argv=<optimized out>) at ../../../../gio/gapplication.c:2470
#52 0x0000555555562464 in  ()
#53 0x0000555555561cd0 in  ()
#54 0x00007ffff41bab97 in __libc_start_main (main=
    0x555555561cc0, argc=1, argv=0x7fffffffe2a8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe298) at ../csu/libc-start.c:310
#55 0x0000555555561d0a in  ()

Platform Information

  • OS: elementary OS
  • OS Version: Hera 5.1.4
  • Hardware info:
    • Dual-Core Intel® Core™ i3-7100U CPU @ 2.40GHz
    • Intel Corporation HD Graphics 620 (rev 02)
    • 8.0 GB memory
    • 47.3 GB storage (SATA SSD)

Please check what applies:

  • I'm using the latest version from git that I've manually compiled
  • I'm using the latest released stable version

Additional context

The issues seems to be in the reuse of a single ClutterGst.Player object: instead of cleanly destroying it, the application is currently changing its properties after creation and setting its position to rewind to the beginning of the stream (which I'm not even sure it's correct in all cases as not all streams are seekable). Recreating the object and the widgets connected to it in PlayerPage.vala before reproducing a new video seems to fix the issue locally -- please consider applying a similar fix.

I'm suspecting this is the same issue as, or connected to the following issues:

I'm opening a new report just in case, since I can reproduce this crash locally, I'm able to provide more detail than previous reports were, and I'm providing a suggested fix.

@jeremypw
Copy link
Collaborator

You ticked both "manually compiled" and "stable" version. Does this mean you get the crash in both cases? I am not getting it with compiled master but the fact you can prevent it by showing debug messages suggests it is a race condition of some kind so may only affect some hardware or some video types (?)

@jmc-88
Copy link
Author

jmc-88 commented May 17, 2020

You ticked both "manually compiled" and "stable" version. Does this mean you get the crash in both cases?

Yes, I can reproduce both on the pre-packaged version and one locally compiled from head.

I am not getting it with compiled master but the fact you can prevent it by showing debug messages suggests it is a race condition of some kind so may only affect some hardware or some video types (?)

I suspect something similar too. At any rate, it may also indicate that some device driver implementations are more strict with requiring proper cleanup/shutdown, and thus possibly a latent bug that has gone unnoticed as maintainers can't reliably reproduce it.

@jeremypw
Copy link
Collaborator

It reliably occurs in #153 PR but not necessarily due to the same problem.

@jeremypw
Copy link
Collaborator

jeremypw commented May 20, 2020

@jmc-88 Rather than destroying and recreating the player and widgets I wonder whether it might be sufficient to reset the pipeline (pipeline.set_state (Gst.State.NULL);) on leaving the PlayerPage? A similar thing is done in PR #153 which now does not crash on playing a second video.

I cannot confirm one way or another as I do not get the crash anyway.

@jeremypw
Copy link
Collaborator

@jmc-88 I have pushed a draft PR that resets the pipeline. It does not cause any regressions afaict so far. Are you in a position to try it out and say whether it fixes your problem?

@jmc-88
Copy link
Author

jmc-88 commented May 20, 2020

I tried it out and it doesn't fix the issue. Furthermore, turns out resetting the player as I initially suggested also doesn't fix it -- just moves the crash around... 😞

@jeremypw
Copy link
Collaborator

@jmc-88 That's a pity - worth a try. Thanks for testing.

@jeremypw
Copy link
Collaborator

@jmc-88 I made some changes to #153 that makes it quite stable for me (see screencast attached thereto). If you have time please try it out, although ryanoko still found it crashed for them. Could you confirm whether you are pausing the video before going back to the Welcome page? In #153 the problem occurred if you did not pause the video first. If you find stopping the video first fixes it I could try putting a longer timeout in the navigate back function rather than just an Idle loop. That would effectively simulate pressing the pause button when you press the back button. I don't like using Timeouts but sometimes needs must.

@jmc-88
Copy link
Author

jmc-88 commented May 24, 2020

Still no luck. Pausing the video or not pausing the video doesn't seem to make a difference, so artificially adding timeouts is likely to be unnecessary.

@jeremypw
Copy link
Collaborator

Thats a pity. Thanks for trying anyway. Could you indicate what kind of video you are using? Or have you tried different formats?

@jmc-88
Copy link
Author

jmc-88 commented May 24, 2020

Could you indicate what kind of video you are using? Or have you tried different formats?

I hadn't -- by chance, all files I tried it on were MP4. I downloaded an Ogg Theora video for testing, and the issue doesn't manifest with it.

@jeremypw
Copy link
Collaborator

Interesting. I have now identified that the crash is associated with the Intel video driver. My current laptop has a NVidia card and driver and I do not get this crash. However, my old laptop has an Intel card and I get the same crash (same backtrace) as you on that machine. It occurs after the second video starts playing - you get a snatch of video and audio before the crash.

At least I have a better chance of finding a solution now.

@jeremypw
Copy link
Collaborator

This is a similar issue: intel/media-driver#862
Is it possible to get a later version of the driver than supplied in Hera?

@jmc-88
Copy link
Author

jmc-88 commented May 25, 2020

Ah, nice find. I built and installed the driver and related dependencies from Git master and the crash is gone.

I initially thought this was an issue specific to Videos as I was unable to reproduce it on other players, but seeing as the Intel drivers are to blame instead, I'm going to close this as it's not a Videos bug.

@jmc-88 jmc-88 closed this as completed May 25, 2020
@jeremypw
Copy link
Collaborator

Glad the updated driver fixed it! It is uncertain whether Videos is abusing GStreamer in some way or whether the difference with other players you tried (I presume they also use GStreamer?) is some subtle timing difference - or perhaps they patch GStreamer or the driver. Hopefully this will go away in the next release of elementary with newer libraries anyway so it is probably not worth spending a lot of time trying to track down.

@jmc-88
Copy link
Author

jmc-88 commented May 25, 2020

Other players I tried were VLC and mpv, both of which don't use GStreamer. If the issue manifests with GStreamer only, it makes perfect sense that I was unable to reproduce it.

I agree, working around this in Videos is not a good investment of your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants