After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 733661 - glimagesink navigation interface causes hangs with X11/GMainLoop event thread
glimagesink navigation interface causes hangs with X11/GMainLoop event thread
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal blocker
: 1.5.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-07-24 11:41 UTC by Matthew Waters (ystreet00)
Modified: 2014-09-09 11:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] GstGlWindow: Introduce navigation thread (10.67 KB, patch)
2014-08-27 17:09 UTC, Vasilis Liaskovitis
reviewed Details | Review
[PATCH] GstGlWindow: Introduce navigation thread (11.70 KB, patch)
2014-09-04 20:57 UTC, Vasilis Liaskovitis
reviewed Details | Review
GstGLWindow: Introduce navigation thread (13.88 KB, patch)
2014-09-09 10:06 UTC, Vasilis Liaskovitis
committed Details | Review

Description Matthew Waters (ystreet00) 2014-07-24 11:41:41 UTC
My understanding of the problem:
1. Navigation event sent from the X11 thread attempts to flush_start/stop and lock basesink's preroll lock.
2. glimagesink may or may not be waiting on a redraw (via g_main_context_invoke) to complete which is waiting on the current X11/GMainContext operation (navigation event) which is called with basesink's preroll lock taken.

Reproduce:
gst-launch-1.0 playbin video-sink="navseek ! glimagesink" and mash the left/right keys.

irc discussion

< ystreet00> slomo: the hang could be from the navigation event being sent from a non-streaming thread
< slomo> ystreet00: we're always sending navigation events from non-streaming threads
< slomo> ystreet00: do you have backtraces?
< ystreet00> slomo: ya :) http://paste.debian.net/111386/
< ystreet00> slomo: it seems to block on the preroll lock in basesink
< slomo> ystreet00: 290 stack frames \o/
< ystreet00> slomo: reproduce by mashing the left/right keys on your keyboard :)
< slomo> ystreet00: interesting backtrace though
< slomo> that shouldn't happen :)
< slomo> especially that flushing causes a deadlock...
< ystreet00> you don't say :)
< slomo> oh
< slomo> so
< slomo> ystreet00: the problem is that glimagesink is rendering something and waiting for the result from the X11 thread... and the X11 thread is sending the seek and waiting for glimagesink to finish
< slomo> maybe we shouldn't do anything complicated from the X11 thread and just dispatch that to some new thread instead
< slomo> however starting a new thread for every navigation event might be a bit crazy
< ystreet00> slomo: this whole rendering thread thing needs looking at anyway
< slomo> ystreet00: why? what else is weird? :)
< slomo> ystreet00: and please put this deadlock in bugzilla with the backlog ↑ so we don't forget :)

backtrace:

(gdb) t a a bt

Thread 14 (Thread 0x7fffc75f5700 (LWP 22271))

  • #0 __lll_lock_wait
    from /usr/lib/libpthread.so.0
  • #1 _L_lock_660
    from /usr/lib/libpthread.so.0
  • #2 pthread_mutex_lock
    from /usr/lib/libpthread.so.0
  • #3 g_mutex_lock
    at gthread-posix.c line 209
  • #4 gst_base_sink_set_flushing
    at gstbasesink.c line 4002
  • #5 gst_base_sink_flush_start
    at gstbasesink.c line 2900
  • #6 gst_base_sink_default_event
    at gstbasesink.c line 2996
  • #7 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #8 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #9 gst_pad_push_event
    at gstpad.c line 4964
  • #10 gst_base_transform_sink_eventfunc
    at gstbasetransform.c line 1902
  • #11 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #12 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #13 gst_pad_push_event
    at gstpad.c line 4964
  • #14 event_forward_func
    at gstpad.c line 2842
  • #15 gst_pad_forward
    at gstpad.c line 2796
  • #16 gst_pad_event_default
    at gstpad.c line 2893
  • #17 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #18 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #19 gst_pad_push_event
    at gstpad.c line 4964
  • #20 event_forward_func
    at gstpad.c line 2842
  • #21 gst_pad_forward
    at gstpad.c line 2796
  • #22 gst_pad_event_default
    at gstpad.c line 2893
  • #23 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #24 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #25 gst_pad_push_event
    at gstpad.c line 4964
  • #26 gst_base_transform_sink_eventfunc
    at gstbasetransform.c line 1902
  • #27 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #28 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #29 gst_pad_push_event
    at gstpad.c line 4964
  • #30 gst_base_transform_sink_eventfunc
    at gstbasetransform.c line 1902
  • #31 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #32 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #33 gst_pad_push_event
    at gstpad.c line 4964
  • #34 gst_base_transform_sink_eventfunc
    at gstbasetransform.c line 1902
  • #35 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #36 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #37 gst_pad_push_event
    at gstpad.c line 4964
  • #38 gst_base_transform_sink_eventfunc
    at gstbasetransform.c line 1902
  • #39 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #40 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #41 gst_pad_push_event
    at gstpad.c line 4964
  • #42 event_forward_func
    at gstpad.c line 2842
  • #43 gst_pad_forward
    at gstpad.c line 2796
  • #44 gst_pad_event_default
    at gstpad.c line 2893
  • #45 gst_play_sink_convert_bin_sink_event
    at gstplaysinkconvertbin.c line 260
  • #46 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #47 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #48 gst_pad_push_event
    at gstpad.c line 4964
  • #49 gst_queue_handle_sink_event
    at gstqueue.c line 768
  • #50 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #51 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #52 gst_pad_push_event
    at gstpad.c line 4964
  • #53 event_forward_func
    at gstpad.c line 2842
  • #54 gst_pad_forward
    at gstpad.c line 2796
  • #55 gst_pad_event_default
    at gstpad.c line 2893
  • #56 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #57 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #58 gst_pad_push_event
    at gstpad.c line 4964
  • #59 event_forward_func
    at gstpad.c line 2842
  • #60 gst_pad_forward
    at gstpad.c line 2796
  • #61 gst_pad_event_default
    at gstpad.c line 2893
  • #62 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #63 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #64 gst_pad_push_event
    at gstpad.c line 4964
  • #65 event_forward_func
    at gstpad.c line 2842
  • #66 gst_pad_forward
    at gstpad.c line 2796
  • #67 gst_pad_event_default
    at gstpad.c line 2893
  • #68 gst_deinterlace_sink_event
  • #69 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #70 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #71 gst_pad_push_event
    at gstpad.c line 4964
  • #72 gst_base_transform_sink_eventfunc
    at gstbasetransform.c line 1902
  • #73 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #74 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #75 gst_pad_push_event
    at gstpad.c line 4964
  • #76 event_forward_func
    at gstpad.c line 2842
  • #77 gst_pad_forward
    at gstpad.c line 2796
  • #78 gst_pad_event_default
    at gstpad.c line 2893
  • #79 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #80 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #81 gst_pad_push_event
    at gstpad.c line 4964
  • #82 event_forward_func
    at gstpad.c line 2842
  • #83 gst_pad_forward
    at gstpad.c line 2796
  • #84 gst_pad_event_default
    at gstpad.c line 2893
  • #85 gst_stream_synchronizer_sink_event
    at gststreamsynchronizer.c line 515
  • #86 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #87 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #88 gst_pad_push_event
    at gstpad.c line 4964
  • #89 event_forward_func
    at gstpad.c line 2842
  • #90 gst_pad_forward
    at gstpad.c line 2796
  • #91 gst_pad_event_default
    at gstpad.c line 2893
  • #92 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #93 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #94 gst_pad_push_event
    at gstpad.c line 4964
  • #95 gst_selector_pad_event
  • #96 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #97 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #98 gst_pad_push_event
    at gstpad.c line 4964
  • #99 event_forward_func
    at gstpad.c line 2842
  • #100 gst_pad_forward
    at gstpad.c line 2796
  • #101 gst_pad_event_default
    at gstpad.c line 2893
  • #102 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #103 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #104 gst_pad_push_event
    at gstpad.c line 4964
  • #105 event_forward_func
    at gstpad.c line 2842
  • #106 gst_pad_forward
    at gstpad.c line 2796
  • #107 gst_pad_event_default
    at gstpad.c line 2893
  • #108 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #109 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #110 gst_pad_push_event
    at gstpad.c line 4964
  • #111 gst_video_decoder_push_event
    at gstvideodecoder.c line 918
  • #112 gst_video_decoder_sink_event_default
    at gstvideodecoder.c line 1217
  • #113 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #114 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #115 gst_pad_push_event
    at gstpad.c line 4964
  • #116 gst_base_transform_sink_eventfunc
    at gstbasetransform.c line 1902
  • #117 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #118 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #119 gst_pad_push_event
    at gstpad.c line 4964
  • #120 gst_base_parse_sink_event_default
    at gstbaseparse.c line 1230
  • #121 gst_h264_parse_event
    at gsth264parse.c line 2132
  • #122 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #123 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #124 gst_pad_push_event
    at gstpad.c line 4964
  • #125 gst_base_transform_sink_eventfunc
    at gstbasetransform.c line 1902
  • #126 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #127 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #128 gst_pad_push_event
    at gstpad.c line 4964
  • #129 gst_base_parse_sink_event_default
    at gstbaseparse.c line 1230
  • #130 gst_h264_parse_event
    at gsth264parse.c line 2147
  • #131 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #132 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #133 gst_pad_push_event
    at gstpad.c line 4964
  • #134 gst_multi_queue_sink_event
    at gstmultiqueue.c line 1617
  • #135 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #136 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #137 gst_pad_push_event
    at gstpad.c line 4964
  • #138 gst_flv_demux_push_src_event
    at gstflvdemux.c line 861
  • #139 gst_flv_demux_handle_seek_pull
    at gstflvdemux.c line 2829
  • #140 gst_flv_demux_src_event
    at gstflvdemux.c line 3120
  • #141 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #142 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #143 gst_pad_push_event
    at gstpad.c line 4964
  • #144 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #145 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #146 gst_pad_push_event
    at gstpad.c line 4964
  • #147 gst_base_parse_handle_seek
    at gstbaseparse.c line 4123
  • #148 gst_base_parse_src_event_default
    at gstbaseparse.c line 1401
  • #149 gst_h264_parse_src_event
    at gsth264parse.c line 2184
  • #150 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #151 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #152 gst_pad_push_event
    at gstpad.c line 4964
  • #153 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1954
  • #154 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #155 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #156 gst_pad_push_event
    at gstpad.c line 4964
  • #157 gst_base_parse_handle_seek
    at gstbaseparse.c line 4123
  • #158 gst_base_parse_src_event_default
    at gstbaseparse.c line 1401
  • #159 gst_h264_parse_src_event
    at gsth264parse.c line 2169
  • #160 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #161 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #162 gst_pad_push_event
    at gstpad.c line 4964
  • #163 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1954
  • #164 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #165 gst_pad_push_event_unchecked
  • #166 gst_pad_push_event
    at gstpad.c line 4964
  • #167 gst_video_decoder_src_event_default
    at gstvideodecoder.c line 1354
  • #168 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #169 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #170 gst_pad_push_event
    at gstpad.c line 4964
  • #171 event_forward_func
    at gstpad.c line 2842
  • #172 gst_pad_forward
    at gstpad.c line 2796
  • #173 gst_pad_event_default
    at gstpad.c line 2893
  • #174 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #175 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #176 gst_pad_push_event
    at gstpad.c line 4964
  • #177 event_forward_func
    at gstpad.c line 2842
  • #178 gst_pad_forward
    at gstpad.c line 2796
  • #179 gst_pad_event_default
    at gstpad.c line 2893
  • #180 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #181 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #182 gst_pad_push_event
    at gstpad.c line 4964
  • #183 gst_input_selector_event
    at gstinputselector.c line 1522
  • #184 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #185 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #186 gst_pad_push_event
    at gstpad.c line 4964
  • #187 event_forward_func
    at gstpad.c line 2842
  • #188 gst_pad_forward
    at gstpad.c line 2796
  • #189 gst_pad_event_default
    at gstpad.c line 2893
  • #190 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #191 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #192 gst_pad_push_event
    at gstpad.c line 4964
  • #193 event_forward_func
    at gstpad.c line 2842
  • #194 gst_pad_forward
    at gstpad.c line 2796
  • #195 gst_pad_event_default
    at gstpad.c line 2893
  • #196 gst_stream_synchronizer_src_event
    at gststreamsynchronizer.c line 200
  • #197 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #198 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #199 gst_pad_push_event
    at gstpad.c line 4964
  • #200 event_forward_func
    at gstpad.c line 2842
  • #201 gst_pad_forward
    at gstpad.c line 2796
  • #202 gst_pad_event_default
    at gstpad.c line 2893
  • #203 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #204 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #205 gst_pad_push_event
    at gstpad.c line 4964
  • #206 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1954
  • #207 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #208 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #209 gst_pad_push_event
    at gstpad.c line 4964
  • #210 event_forward_func
    at gstpad.c line 2842
  • #211 gst_pad_forward
    at gstpad.c line 2796
  • #212 gst_pad_event_default
    at gstpad.c line 2893
  • #213 gst_deinterlace_src_event
    at gstdeinterlace.c line 2731
  • #214 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #215 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #216 gst_pad_push_event
    at gstpad.c line 4964
  • #217 event_forward_func
    at gstpad.c line 2842
  • #218 gst_pad_forward
    at gstpad.c line 2796
  • #219 gst_pad_event_default
    at gstpad.c line 2893
  • #220 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #221 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #222 gst_pad_push_event
    at gstpad.c line 4964
  • #223 event_forward_func
    at gstpad.c line 2842
  • #224 gst_pad_forward
    at gstpad.c line 2796
  • #225 gst_pad_event_default
    at gstpad.c line 2893
  • #226 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #227 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #228 gst_pad_push_event
    at gstpad.c line 4964
  • #229 event_forward_func
    at gstpad.c line 2842
  • #230 gst_pad_forward
    at gstpad.c line 2796
  • #231 gst_pad_event_default
    at gstpad.c line 2893
  • #232 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #233 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #234 gst_pad_push_event
    at gstpad.c line 4964
  • #235 event_forward_func
    at gstpad.c line 2842
  • #236 gst_pad_forward
    at gstpad.c line 2796
  • #237 gst_pad_event_default
    at gstpad.c line 2893
  • #238 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #239 gst_pad_push_event_unchecked
  • #240 gst_pad_push_event
    at gstpad.c line 4964
  • #241 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1954
  • #242 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #243 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #244 gst_pad_push_event
    at gstpad.c line 4964
  • #245 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1954
  • #246 gst_video_scale_src_event
    at gstvideoscale.c line 1487
  • #247 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #248 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #249 gst_pad_push_event
    at gstpad.c line 4964
  • #250 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1954
  • #251 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #252 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #253 gst_pad_push_event
    at gstpad.c line 4964
  • #254 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1954
  • #255 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #256 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #257 gst_pad_push_event
    at gstpad.c line 4964
  • #258 event_forward_func
    at gstpad.c line 2842
  • #259 gst_pad_forward
    at gstpad.c line 2796
  • #260 gst_pad_event_default
    at gstpad.c line 2893
  • #261 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #262 gst_pad_push_event_unchecked
    at gstpad.c line 4839
  • #263 gst_pad_push_event
    at gstpad.c line 4964
  • #264 event_forward_func
    at gstpad.c line 2842
  • #265 gst_pad_forward
    at gstpad.c line 2796
  • #266 gst_pad_event_default
    at gstpad.c line 2893
  • #267 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #268 gst_pad_send_event
    at gstpad.c line 5298
  • #269 gst_navseek_seek
    at gstnavseek.c line 140
  • #270 gst_navseek_src_event
    at gstnavseek.c line 257
  • #271 gst_pad_send_event_unchecked
    at gstpad.c line 5141
  • #272 gst_pad_send_event
    at gstpad.c line 5298
  • #273 gst_glimage_sink_navigation_send_event
    at gstglimagesink.c line 199
  • #274 ffi_call_unix64
    from /usr/lib/libffi.so.6
  • #275 ffi_call
    from /usr/lib/libffi.so.6
  • #276 g_cclosure_marshal_generic
    at gclosure.c line 1445
  • #277 g_closure_invoke
    at gclosure.c line 768
  • #278 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #279 g_signal_emit_valist
    at gsignal.c line 3307
  • #280 g_signal_emit
    at gsignal.c line 3363
  • #281 gst_gl_window_x11_handle_event
  • #282 x11_event_source_dispatch
    at x11_event_source.c line 70
  • #283 g_main_dispatch
    at gmain.c line 3064
  • #284 g_main_context_dispatch
    at gmain.c line 3663
  • #285 g_main_context_iterate
    at gmain.c line 3734
  • #286 g_main_loop_run
    at gmain.c line 3928
  • #287 gst_gl_context_create_thread
    at gstglcontext.c line 845
  • #288 g_thread_proxy
    at gthread.c line 764
  • #289 start_thread
    from /usr/lib/libpthread.so.0
  • #290 clone
    from /usr/lib/libc.so.6

Comment 1 Vasilis Liaskovitis 2014-08-27 17:09:39 UTC
Created attachment 284623 [details] [review]
[PATCH] GstGlWindow: Introduce navigation thread

This RFC patch introduces a navigation thread in GstGLWindow to dispatch navigation events. GstGlWindow_x11 thread is changed to invoke the navigation thread for navigation dispatching, instead of emiting the events itself. The deadlock should be avoided this way.
 
The navigation thread is currently part of GstGLWindow and not implemented in
separate subclasses / backends yet. Perhaps this is needed?

Also commit 4dacc4ba introduced get_surface_dimensions method. The problem for the X11 backend, is that now this function is called from the navigation thread, resulting in xlib aborting due to multithreaded access:

[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been
called
[xcb] Aborting, sorry about that. 

The call to gst_gl_window_get_surface_dimensions has been commented for now. I am not sure if this is considered a gst-launch problem (gst-launch not calling XInitThreads), or a design problem of this navigation thread solution. Also the commit that introduced get_surface_dimensions (4dacc4ba) could also be reverted for now if needed.
Comment 2 Matthew Waters (ystreet00) 2014-09-04 07:36:17 UTC
Review of attachment 284623 [details] [review]:

Looks good, some comments below.

(In reply to comment #1)
> The navigation thread is currently part of GstGLWindow and not implemented in
> separate subclasses / backends yet. Perhaps this is needed?

It will be needed at some point :)

> Also commit 4dacc4ba introduced get_surface_dimensions method. The problem for
> the X11 backend, is that now this function is called from the navigation
> thread, resulting in xlib aborting due to multithreaded access:

For x11 it would make sense to store the window dimensions in the subclass and return the cached values in get_surface_dimensions ().  The other backends will most likely be fine with all of this.

If you have the GST_GL_XINITHTHREADS environment variable set, then XInitThreads() will be called on plugin initialization.  However it would be nice to avoid requiring XInitThreads in the basic gst-launch case.
Comment 3 Sebastian Dröge (slomo) 2014-09-04 11:12:14 UTC
This needs to be fixed before 1.5.1 as it's causing a regression btw
Comment 4 Vasilis Liaskovitis 2014-09-04 11:19:40 UTC
(In reply to comment #2)
thanks for reviewing

> Review of attachment 284623 [details] [review]:
>
> Looks good, some comments below.
>
> (In reply to comment #1)
> > The navigation thread is currently part of GstGLWindow and not implemented in
> > separate subclasses / backends yet. Perhaps this is needed?
>
> It will be needed at some point :)

ok. So should I work on it (i.e. making only dummy and x11 subclass implementation for now) or leave it in GstGLWindow for first inclusion?

>
> > Also commit 4dacc4ba introduced get_surface_dimensions method. The problem for
> > the X11 backend, is that now this function is called from the navigation
> > thread, resulting in xlib aborting due to multithreaded access:
>
> For x11 it would make sense to store the window dimensions in the subclass and
> return the cached values in get_surface_dimensions ().  The other backends will
> most likely be fine with all of this.

makes sense, I 'll try this.
Comment 5 Vasilis Liaskovitis 2014-09-04 20:57:24 UTC
Created attachment 285414 [details] [review]
[PATCH] GstGlWindow: Introduce navigation thread

v1 -> v2 
- gst_gl_window_x11_get_surface_dimensions now uses values retrieved from x11 thread, to avoid xlib multithreaded access abort.
- cleaned up some leftover debugging

navigation thread is still not implemented in subclasses.
Comment 6 Matthew Waters (ystreet00) 2014-09-05 05:54:51 UTC
Review of attachment 285414 [details] [review]:

::: gst-libs/gst/gl/gstglwindow.c
@@ +242,3 @@
 
+  window->priv->navigation_thread = g_thread_new ("gstglnavigation",
+      (GThreadFunc) gst_gl_window_navigation_thread, window);

I'm not sure if it matters but this is racy with event sending from backends.  The thread could have not been created yet when the backends try to send events through it.

You might want to look at the gst_gl_context_create in gstglcontext.c for some inspiration.

@@ +347,2 @@
 /**
+ * gst_gl_window_run:

run_navigation
Comment 7 Vasilis Liaskovitis 2014-09-09 10:06:48 UTC
Created attachment 285724 [details] [review]
GstGLWindow: Introduce navigation thread

v2 -> v3:

Added Gmutex and Gcond for creation / destruction of navigation thread
Comment 8 Matthew Waters (ystreet00) 2014-09-09 11:55:26 UTC
commit 3c3b78508fb7f283606db661c4e838daa4b3d865
Author: Vasilis Liaskovitis <vliaskov@gmail.com>
Date:   Tue Sep 9 12:01:47 2014 +0200

    GstGLWindow: Introduce navigation thread
    
    This thread dispatches navigation events. It is needed to avoid deadlocks
    between window backend threads that emit navigation events (e.g. X11/GMainLoop
    thread) and consumers of navigation events such as glimagesink, see
    https://bugzilla.gnome.org/show_bug.cgi?id=733661
    
    GstGlWindow_x11 thread is changed to invoke the navigation thread for navigation
    dispatching, instead of emiting the event itself. Othe backends beside X11 do
    not dispatch navigation events yet, but should use this thread when dispatching
    these events in the future.
    
    The navigation thread is currently part of GstGLWindow and not implemented in
    separate subclasses / backends. This will be needed in the future.
    
    gst_gl_window_x11_get_surface_dimensions is also changed to use a cached value
    of the window's width, height. These values are now retrieved in the X11
    thread, function gst_gl_window_x11_handle_event. This change is needed because
    otherwise the XGetWindowAttributes gets called from the navigation thread,
    leading to xlib aborting due to multithreaded access (if XInitThreads is not
    called before, as is the case for gst-launch)