Gstreamer segfault > GstBus signal watch?

When doing lots of gstreamer (1.0) calls, this segmentation fault pops up:

....
GStreamer-CRITICAL **: gst_poll_read_control: assertion 'set != NULL' failed
GStreamer-CRITICAL **: gst_poll_read_control: assertion 'set != NULL' failed
GStreamer-CRITICAL **: gst_bus_create_watch: assertion 'bus->priv->poll != NULL' failed
GLib-CRITICAL **: g_source_set_callback: assertion 'source != NULL' failed
Segmentation fault (core dumped)

It seems to be related to a GstBus overload, and the need to remove references to the bus with gst_bus_remove_signal_watch(). See > https://bugs.webkit.org/show_bug.cgi?id=107544

[Ubuntu 13, gstreamer 1.0]

oh, thanks, i’ve just fixed it (haven’t tested though since i’ve never got that crash)

in line 471 in ofGstUtils add:

		if(bus) gst_bus_remove_signal_watch(bus);

Tested it, but it still crashes.

I also tested with g_source_remove(), as that actually seems to be the recommended way of removing gst_bus_add_watch() (gst_bus_remove_signal_watch() is for gst_bus_add_signal_watch())

guint 				bus_watch_id;

if(bus){
    bus_watch_id = gst_bus_add_watch (bus, (GstBusFunc) busFunction, this);
}

if(bus) g_source_remove (bus_watch_id);

Also still crashes.

what are you trying to do? i guess closing and opening several videos, but are you destroying the objects or calling close and then load again?

also can you debug the app to see where it crashes, it’ll probably be inside gstreamer but the beginning of the stack trace might be helpful

Opening and destroying multiple videoplayers in a short time. (but no reloading on already open videoplayers)

gdb shows the segmentation fault to originate from g_source_attach()

[New Thread 0x7ffea769e700 (LWP 32563)]
(planeEtoiles:31771): GStreamer-CRITICAL **: gst_poll_write_control: assertion 'set != NULL' failed
(planeEtoiles:31771): GStreamer-CRITICAL **: gst_poll_write_control: assertion 'set != NULL' failed
(planeEtoiles:31771): GStreamer-CRITICAL **: gst_poll_read_control: assertion 'set != NULL' failed
(planeEtoiles:31771): GStreamer-CRITICAL **: gst_poll_write_control: assertion 'set != NULL' failed
(planeEtoiles:31771): GStreamer-CRITICAL **: gst_poll_write_control: assertion 'set != NULL' failed
(planeEtoiles:31771): GStreamer-CRITICAL **: gst_poll_free: assertion 'set != NULL' failed
(planeEtoiles:31771): GStreamer-CRITICAL **: gst_poll_read_control: assertion 'set != NULL' failed
(planeEtoiles:31771): GStreamer-CRITICAL **: gst_poll_write_control: assertion 'set != NULL' failed
(planeEtoiles:31771): GStreamer-CRITICAL **: gst_poll_read_control: assertion 'set != NULL' failed
(planeEtoiles:31771): GStreamer-CRITICAL **: gst_poll_read_control: assertion 'set != NULL' failed
(planeEtoiles:31771): GStreamer-CRITICAL **: gst_bus_create_watch: assertion 'bus->priv->poll != NULL' failed
(planeEtoiles:31771): GLib-CRITICAL **: g_source_set_callback: assertion 'source != NULL' failed
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff50b13c7 in g_source_attach () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) 

can you type bt in gdb after it crashes so it shows the full stack trace?

=need to learn some more about gdb …

Here is the stack trace of the version, where i am loading lots of videos dynamically:

(planeEtoiles:20323): GLib-CRITICAL **: g_source_set_callback: assertion 'source != NULL' failed
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff50b13c7 in g_source_attach () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) bt
#0  0x00007ffff50b13c7 in g_source_attach () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007ffff7255388 in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#2  0x00007ffff725549f in gst_bus_add_watch_full () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#3  0x00000000004a7149 in ofGstUtils::startPipeline() ()
#4  0x00000000004a73ec in ofGstUtils::setPipelineWithSink(_GstElement*, _GstElement*, bool) ()
#5  0x00000000004a5a77 in ofGstVideoPlayer::loadMovie(std::string) ()
#6  0x00000000004a4b0a in ofVideoPlayer::loadMovie(std::string) ()
#7  0x000000000046b58a in videoElement::loadMovie(std::string) ()
#8  0x000000000046b947 in videoElement::videoElement(std::string, bool) ()
#9  0x000000000045eed9 in planeApp::blobEnterStage(int&) ()
#10 0x0000000000461596 in Poco::PriorityDelegate<planeApp, int, false>::notify(void const*, int&) ()
#11 0x00000000004495fb in Poco::PriorityStrategy<int, Poco::AbstractPriorityDelegate<int> >::notify(void const*, int&) ()
#12 0x000000000044a694 in void ofNotifyEvent<ofEvent<int>, int, Blob>(ofEvent<int>&, int&, Blob*) ()
#13 0x0000000000448868 in Blob::processRawPosition(float, float, float, int) ()
#14 0x000000000045d65e in planeApp::update() ()
#15 0x00000000004d419e in Poco::PriorityDelegate<ofBaseApp, ofEventArgs, false>::notify(void const*, ofEventArgs&) ()
#16 0x00000000004a8f1d in Poco::PriorityStrategy<ofEventArgs, Poco::AbstractPriorityDelegate<ofEventArgs> >::notify(void const*, ofEventArgs&) ()
#17 0x00000000004a97dd in void ofNotifyEvent<ofEvent<ofEventArgs>, ofEventArgs>(ofEvent<ofEventArgs>&, ofEventArgs&) ()
#18 0x00000000004d648f in ofAppGLFWWindow::runAppViaInfiniteLoop(ofBaseApp*) ()
#19 0x00000000004d3219 in ofRunApp(ofBaseApp*) ()

And then i have one from when i preload ~200 videos in setup(). The videos are rather small. Run with gdb, it crashes in setup.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff50b13c7 in g_source_attach () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) bt
#0  0x00007ffff50b13c7 in g_source_attach () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007ffff7255388 in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#2  0x00007ffff725549f in gst_bus_add_watch_full () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#3  0x00000000004a7417 in ofGstUtils::startPipeline() ()
#4  0x00000000004a76ba in ofGstUtils::setPipelineWithSink(_GstElement*, _GstElement*, bool) ()
#5  0x00000000004a5d45 in ofGstVideoPlayer::loadMovie(std::string) ()
#6  0x00000000004a4dd8 in ofVideoPlayer::loadMovie(std::string) ()
#7  0x000000000046b878 in videoElement::loadMovie(std::string) ()
#8  0x000000000046bc35 in videoElement::videoElement(std::string, bool) ()
#9  0x00000000004597b2 in planeApp::initScenes() ()
#10 0x000000000045cd3d in planeApp::setup() ()
#11 0x00000000004d446e in Poco::PriorityDelegate<ofBaseApp, ofEventArgs, false>::notify(void const*, ofEventArgs&) ()
#12 0x00000000004a91eb in Poco::PriorityStrategy<ofEventArgs, Poco::AbstractPriorityDelegate<ofEventArgs> >::notify(void const*, ofEventArgs&) ()
#13 0x00000000004a9a8b in void ofNotifyEvent<ofEvent<ofEventArgs>, ofEventArgs>(ofEvent<ofEventArgs>&, ofEventArgs&) ()
#14 0x00000000004d675a in ofAppGLFWWindow::runAppViaInfiniteLoop(ofBaseApp*) ()
#15 0x00000000004d34e9 in ofRunApp(ofBaseApp*) ()
#16 0x0000000000416e75 in main ()
(gdb) 

Run normally (no gdb) the preloaded-videos version seems to behave better now, though it constantly throws GStreamer-CRITICAL errors like gst_poll_write_control: assertion 'set != NULL' failed and gst_poll_read_control: assertion 'set != NULL' failed. And it weirdly doesn’t let me load any videos dynamically anymore, insisting the files don’t exist (even though they do).

Busy with another project now, but i should be back to investigating this some more, probably next week.