Gstreamer buffer size and segmentation fault

I am working on raspberry pi5. This is my pipeline. I have set bypass queue size=10000 and the rest of the pipeline is same as original. Max buffer size is allocating which memory and how to set it? What are its parameters? Is it depending on something? I am facing segmentation fault error randomly sometime after 10 minutes sometime after 2 hour. So how do i overcome this issue?

Hey @malikharis3984


Your pipeline is quite complex, which can make it challenging to debug everything simultaneously. I suggest breaking down the debugging process into stages. Here are some recommendations based on potential issues I’ve identified in the pipeline:

Adjust Queue Sizes:

Instead of using a very large bypass queue, aim to balance the sizes of all queues in your pipeline. Start with smaller values, such as 30-100 for max-size-buffers, and adjust based on observed performance.

Memory Management:

Enable detailed logging using GST_DEBUG=*:4 to monitor memory usage. Verify that the Raspberry Pi 5 has enough available RAM to support your pipeline. Tools like valgrind can be helpful in detecting memory leaks.

Buffer Allocation:

Use the max-size-bytes property to limit the total memory usage by a queue. Set this value according to your available system memory and the size of your video frames.

Leaky Queues:

For live pipelines, consider using leaky queues to drop older frames instead of accumulating them. Configure a queue with:

queue leaky=downstream max-size-buffers=100 max-size-bytes=10485760 max-size-time=0

Sync Issues:

Ensure that synchronization between elements is properly managed, particularly between the AI processing and bypass paths. If dealing with live sources, consider setting sync=false on the video sink to handle timing discrepancies.

Element-specific Tuning:

Adjust the properties of specific elements, such as hailonet and hailofilter, to match the requirements of your model and to optimize performance.

In the official pipeline that hailo provided in hailo-rpi5-examples the max_size_buffer of bypass queue is 20 in detection.py but, In QUEUE function of hailo_rpi_common.py the max_size_buffer=3. Why is that so? Explain me this.