Free(): invalid pointer while using smart record in deepstream python

Continuing the discussion from DeepStream SDK FAQ:

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) - Jetson Nano
• DeepStream Version - 6.0.1
• JetPack Version (valid for Jetson only) - 4.6.2
• TensorRT Version - 8.2
• NVIDIA GPU Driver Version (valid for GPU only) - 10.2
• Issue Type( questions, new requirements, bugs)

I am using the deeptream-test3.py code to store clips using smart record with a period of a 5-minute interval. Every 5 minutes, the clips will be stored. However, I encountered the following error while storing the clips:
'free(): invalid pointer.
Aborted (core dumped).

• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)

When running the deeptream-test3.py code with smart recording for two RTSP streams, the clips will be stored at 5-minute intervals. The code initiates the record event using the probe function upon startup and stops after 5 minutes. The process then repeats, starting the recording event again.

• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

could you help me to resolve this issue?

Did it crash every time you stored the clips? Could you use the gdb tool to debug that preliminary debug?

Did it crash every time you stored the clips?

yes, these are the errors , I got at different time,

free(): invalid pointer
Aborted (core dumped)

sys:1: Warning: invalid (NULL) pointer instance
sys:1: Warning: g_signal_emit_by_name: assertion ‘G_TYPE_CHECK_INSTANCE (instance)’ failed
free(): invalid pointer
Aborted (core dumped)

sys:1: Warning: instance with invalid (NULL) class pointer
sys:1: Warning: g_signal_emit_by_name: assertion ‘G_TYPE_CHECK_INSTANCE (instance)’ failed
malloc(): smallbin double linked list corrupted
Aborted (core dumped)

malloc_consolidate(): invalid chunk size
Aborted (core dumped)

sys:1: Warning: instance with invalid (NULL) class pointer
sys:1: Warning: g_signal_emit_by_name: assertion ‘G_TYPE_CHECK_INSTANCE (instance)’ failed
Segmentation fault (core dumped)

I have tried the FAQ with 2 rtsp sources. There are no crash. Have you modify any code to the patch provided by FAQ?

Yes, I modified what they provided, but in PyDS version 1.1.1 patch.
can you share the code?

@yuweiw
Does nvurisrcbin 's smart-record use an encoder for storing video clips, and if so, which one does it use—hardware encoder or software encoder?

The code is on the FAQ: test.py.diff and gpointer_bind.diff.

hardware encoder.

see, NVENC: OFF

If you want to encode by yourself, like our demo deepstream_test_sr_app.c. We sugget you use the hardware encoder. But just for our smart record, it doesn’t need a encoder. You can refer to our guide: https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Smart_video.html.
The original raw data entering Smart Recording Module is originally the H264 stream in RTSP.

@yuweiw
can you share the code you tried with 2 rtsp sources?

It’s the deepstream-test3 with the patch FAQ.
Just run that with python3 deepstream_test_3.py -i rtsp://127.0.0.1/video1 rtsp://127.0.0.1/video2 -s in the README file.