I’m using DeepStream (7.1) and handling dynamic RTSP sources via uridecodebin wrapped inside Gst Bin. Upon EOS , I remove the source from the pipeline and create new Gst Bin and attempt reconnection.
Now I’m also logging the ram utilization in the deepstream docker and it seems to only increase on reconnection.
To debug this issue, I created a simple pipeline: two RTSP sources, each wrapped in a GstBin, feeding into a newstreammux and then a fakesink. One RTSP source produces EOS every 5 seconds, the other after ~3 hours.
The reconnection process works as follows:
EOS is detected on a pad probe on the GstBin.
A bus callback triggers the EOS handler.
The handler unlinks the pads between streammux and the EOS bin.
The streammux pad is released.
The EOS bin is set to NULL state.
Once the state change is complete, a flush stop event is sent.
The EOS bin is then removed from the pipeline.
This handler runs via Gst.idle_add and performs the operation only in Gst.PadProbeType.IDLE.
For every EOS event from the source generating EOS every 5 seconds, memory initially increases by 7–10 MB. After a few EOS cycles, the increase stabilizes at 0.25–1 MB per reconnection.
Please note that the memory stats given above are only on reconnection for the 5 sec eos source, single source reconnection only.
Could you attach your source code about the simple pipeline so that we can try that on our side?
And how to create a rtsp source produces EOS every 5 seconds?
yes the dependencies were installed and on testing the changes made as suggested. The memory increment for every eos went up to 50-100 mb, it is increasing more rapidly. I have also added the nvvideoconvert->caps_vidconvsrc elements right after the decoder.
OK. Thanks for your investigation. From the results, it is hard to determine which plugin is causing the leak. I’ll try the reconnection function with our nvurisrcbin plugin. If there are no issues, we recommend that you directly use this plugin to achieve your needs.
The memory is basically stable. Could you please try using nvurisrcbin plugin to fulfill your reconnection requirements? It is more convenient to use and gets relatively stable memory.
According to the data you have collected, it took approximately 2 hours and 48 minutes. The reconnection occurred every 5 seconds, and the memory increased from 97.5 to 109.40.
Each reconnection results in approximately 5K increase in memory. As you’ve said, the leak is very slow now. We suggest that you adopt this solution first. We will do a simultaneous analysis.
Thank you for the clarification. I’d like to point out that the increase from 97.5 to 109.40 MB actually occurred over 2 minutes, not 2 hours. Also, this observation was made with just a single source reconnection. In cases where multiple sources are involved, we can expect the increments to be significantly larger.