Nvstreammux received signal SIGSEGV when stop rtsp pipeline

I create many rtsp pipelines “rtspsrc->rtph264depy->decodebin->fakesink” and one algrithm pipeline “appsrc->queue->nvstreammux->nvinfer->fakesink”. Add a probe on sink pad of fakesink
of rtsp pipeline. Copy gst-buffer to push to appsrc. When I add rtsp pipeline dynamiclly, it works well. But when I remove rtsp pipeline dynamiclly, program crash at nvstreammux.
The way i stop rtsp pipeline is to call fucntion “gst_element_set_state(pipeline_, GST_STATE_NULL)”.
I am confused why stop one pipeline can affect another pipeline.
Here is the coredump.

Thread 35 “nvstreammux:src” received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f328fac50 (LWP 28857)]
0x0000007fa75c5588 in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libnvbufsurftransform.so.1.0.0
(gdb) bt
#0 0x0000007fa75c5588 in () at /usr/lib/aarch64-linux-gnu/tegra/libnvbufsurftransform.so.1.0.0
#1 0x0000007fa75c9d00 in NvBufSurfTransform () at /usr/lib/aarch64-linux-gnu/tegra/libnvbufsurftransform.so.1.0.0
#2 0x0000007f8c8b63d8 in convert_batch_and_push_to_input_thread(GstNvInfer*, GstNvInferBatch*, GstNvInferMemory*) (nvinfer=0x7fac288dd0, batch=0x7ecc049de0, mem=0x7f0cb7a1c0) at gstnvinfer.cpp:1231
#3 0x0000007f8c8b6e34 in gst_nvinfer_process_full_frame(GstNvInfer*, GstBuffer*, NvBufSurface*) (nvinfer=0x7fac288dd0, inbuf=0x7ee404c440, in_surf=0x7f040080b0) at gstnvinfer.cpp:1355
#4 0x0000007f8c8b84a8 in gst_nvinfer_submit_input_buffer(GstBaseTransform*, gboolean, GstBuffer*) (btrans=0x7fac288dd0, discont=0, inbuf=0x7ee404c440) at gstnvinfer.cpp:1744
#5 0x0000007fb756886c in () at /usr/lib/aarch64-linux-gnu/libgstbase-1.0.so.0
(gdb) f 2
#2 0x0000007f8c8b63d8 in convert_batch_and_push_to_input_thread (nvinfer=0x7fac288dd0, batch=0x7ecc049de0, mem=0x7f0cb7a1c0)
at gstnvinfer.cpp:1231
1231 err = NvBufSurfTransform (&nvinfer->tmp_surf, mem->surf,
(gdb)

Hi,

please take a look here for the supposed correct procedure to stop and release a source bin.

It still, randomly, crashes for me sometimes when I remove the last pad (both the sample and my app) but this isn’t an issue in my use case. I hope this helps, regards

Hi,
Thanks for reply.
I have already take a reference of the sample. Below is my code.

gst_element_set_state(queue, GST_STATE_NULL);
gst_element_get_state(queue, NULL, NULL, GST_CLOCK_TIME_NONE);
gst_element_set_state(appsrc, GST_STATE_NULL);
gst_element_get_state(appsrc, NULL, NULL, GST_CLOCK_TIME_NONE);
std::string sink_pad_name = “sink_”;
sink_pad_name += std::to_string(vid);
GstPad *sinkpad = gst_element_get_static_pad(mux_, sink_pad_name.c_str());
if (NULL == sinkpad) {
std::cout << “get mux pad " << sink_pad_name << " is NULL.” << std::endl;
return -1;
}
gst_pad_send_event(sinkpad, gst_event_new_flush_stop(FALSE));
gst_element_release_request_pad(mux_, sinkpad);
gst_object_unref(sinkpad);
gst_bin_remove(GST_BIN(pipeline_), appsrc);
gst_bin_remove(GST_BIN(pipeline_), queue);

I have prvoed there is no problem of adding or removing link dynamiclly. But when I shutdown rtsp pipeline, algrithm pipeline will crash. It is so odd. the two pipeline has no directly relationship. The only suspected point is the two pipelines both use hardware of nvidia to decode and transform or do something other. I doubt shutdowning rtsp pipeline cause confict with algrithm pipeline.

Hi,
Please share a patch based on the reference sample so that we can reproduce the issue.

I’m closing this topic due to there is no update from you for a period, assuming this issue was resolved.
If still need the support, please open a new topic. Thanks

I has avoided the problem. I found gstbuffer generated by rtsp-stream pipeline should be clear up at algrithm pipeline befor shuting down rtsp-stream pipeline. I do not know the root cause.