GNOME Bugzilla – Bug 779334
SoupHttpClientSink crash on stop
Last modified: 2018-01-18 22:21:00 UTC
I am working on an iOS app and stopping a souphttpclientsink can sometimes lead to a crash in libsoup. This seems to happen more frequently on poor networks. Here's the crash log I'm seeing: #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 the following crash when 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*)
I have created a sample Xcode project that you can download here: 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. Please let me know if you have any questions about how this works.
One other interesting comment is the crash sometimes happens in different places. I am attaching a few screenshots with the different stack traces I'm seeing in Xcode.
Created attachment 346925 [details] Stack Trace 1
Created attachment 346926 [details] Stack Trace 2
Created attachment 346927 [details] Stack Trace 3
I have created a new sample project where it will automatically start/stop the pipeline. After around 15-20 tries, you should see the crash. You can find this project at: https://www.dropbox.com/s/2hqac8vf7ikawyo/SoupHttpClientCrash%202.zip?dl=0.
Sorry for the additional comment, but I had to slightly modify the project so the new project is actually at: https://www.dropbox.com/s/j9wmhzrtbmqi3w9/SoupHttpClientCrash%202.zip?dl=0. Please disregard my previous comment.
A crash in alloc functions look like prior memory arena corruption. Run with valgrind and see if anything pops up beforehand.
joel, can you try again with master to see if the issue still happens ? And if so try runnign with valgrind as Vincent mentioned.
Thanks for making the effort to produce a test application. Links are 404 now though, and no follow-up to the questions. Closing this bug report as no further information has been provided. Please feel free to reopen this bug report if you can provide the information that was asked for in a previous comment. Thanks!