Crash in souphttpclientsink

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Crash in souphttpclientsink

jml5qh
Occasionally I get a crash in souphttpclientsink when I try and stop the stream. I'm on iOS and here's the crash log:

#12
Crashed: souphttpclientsink-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000
 Raw Text
0
soup-socket-properties.c line 66
soup_socket_properties_push_async_context
1
soup-connection.c line 424
soup_connection_connect_async
2
soup-session.c line 1969
soup_session_process_queue_item
3
soup-session.c line 2095
async_run_queue
4
soup-session.c line 2131
idle_run_queue
5
gmain.c line 3237
g_main_context_dispatch
6
gmain.c line 3971
g_main_context_iterate
7
gmain.c line 4162
g_main_loop_run
8
souphttpclientsink.c line 550
thread_func
9
gthread.c line 778
g_thread_proxy


I also see that the stop has been called:

2
gthread-posix.c line 1214
g_system_thread_wait
3
gthread.c line 948
g_thread_join
4
souphttpclientsink.c line 647
gst_soup_http_client_sink_stop
5
gstbasesink.c line 5223
gst_base_sink_change_state
6
gstelement.c line 2648
gst_element_change_state
7
gstelement.c line 2602
gst_element_set_state_func
8
gstbin.c line 2414
gst_bin_change_state_func
9
gstpipeline.c line 499
gst_pipeline_change_state
10
gstelement.c line 2648
gst_element_change_state
11
gstelement.c line 2694
gst_element_change_state
12
gstelement.c line 2694
gst_element_change_state
13
gstelement.c line 2602
gst_element_set_state_func
14
[Redacted].cpp line 260
stopPlayingAndDeallocPipelines()
15
[Redacted].cpp line 74
setupPipelines()
16
[Redacted].cpp line 23
startInternal(void*)
Reply | Threaded
Open this post in threaded view
|

Re: Crash in souphttpclientsink

jml5qh
I have created a sample project that reproduces the crash: https://www.dropbox.com/s/cw4lwmd7g3mk3dc/SoupHttpClientCrash.zip?dl=0. This pretty much mimics my app where I have an RTSP stream and souphttpclientsink stream going at the same time. The URLs are set to blank, but you can set them in ViewController.didClickStart. In this method, there is a call to createRtspStream with comments about where you insert the different stream URLs.

On the UI, there are just two buttons for stop/start. If you alternate pressing start and stop to simulate restarting the stream you should be able to reproduce. Unfortunately, you won't be able to reproduce it every time but it seems to be a little easier to reproduce in poorer network conditions.

I have also submitted a bug ticket at: https://bugzilla.gnome.org/show_bug.cgi?id=779334. Please let me konw if you have any questions or issues.
Reply | Threaded
Open this post in threaded view
|

Re: Crash in souphttpclientsink

jml5qh
This post was updated on .
I have created another project at https://www.dropbox.com/s/j9wmhzrtbmqi3w9/SoupHttpClientCrash%202.zip?dl=0 where I can consistently reproduce the crash. Once you press "Start", we will continually start/stop the pipeline. After around 15-20 times you will get the  crash. Any ideas?
Reply | Threaded
Open this post in threaded view
|

Re: Crash in souphttpclientsink

amistry
For benefit of others, here is what fixed the souphttpclientsink crash on the iOS platform. When the pipeline is signaled to stop, the souphttpclientsink plugin's stop gets called and tries to abort the soup session in turn results to free some resources. These resources are still being used by souphttpclientsink-thread, which is still running.

Following code snippet of gst_soup_http_client_sink_stop function should be executed post g_thread_join on the souphttpclientsink-thread.  This fix basically allows all remaining data to be handled by the main loop and returned gracefully before the soup session is aborted.

if (souphttpsink->prop_session == NULL) {
    soup_session_abort (souphttpsink->session);
    g_object_unref (souphttpsink->session); }

Hope it helps!