Nvargus Can not get HW buffer from FD… Exiting on L4T R32.4.4 with multiple cameras

Hi,

I’m working with a Jetson running L4T R32.4.4 (JetPack 4.4.1) on a Jetson Nano. I’m using 4K@30FPS and 2x HD @ 10FPS cameras via Argus/GStreamer pipelines.

After long streaming sessions (sometimes 10 minutes, sometimes longer), the pipelines crash with the following nvargus report:

NVMAP_IOC_WRITE failed: Interrupted system call
(payload:1): GStreamer-CRITICAL **: 20:31:59.750: gst_mini_object_unlock: 
assertion ‘(state & access_mode) == access_mode’ failed
nvbuf_utils: dmabuf_fd 1055 mapped entry NOT found
nvbuf_utils: Can not get HW buffer from FD… Exiting…
NvBufferGetParams failed for src_dmabuf_fds[2]
nvbuffer_composite Failed
  • In dmesg there is no additional information, camera driver just report that it stops streaming (because of nvargus crash). after restarting nvargus and pipeline stream works fine (until next crash occurs).
  • In trace log
echo 1 > /sys/kernel/debug/tracing/tracing_on
echo 30720 > /sys/kernel/debug/tracing/buffer_size_kb
echo 1 > /sys/kernel/debug/tracing/events/tegra_rtcpu/enable
echo 1 > /sys/kernel/debug/tracing/events/freertos/enable
echo 2 > /sys/kernel/debug/camrtc/log-level
echo 1 > /sys/kernel/debug/tracing/events/camera_common/enable
echo > /sys/kernel/debug/tracing/trace
cat /sys/kernel/debug/tracing/trace

I didn’t observe anything strange,i start tracing after starting the pipeline and first message i saw was immediately after crash and it was telling that it shutting down the camera, so sa me as in dmesg.

  • I monitored DMA buffer usage in /sys/kernel/debug/dma_buf/bufinfo: the count typically sits around 600–750, with a maximum around 830 before crashes. The is not always above 800 when crash occurs.
  • Every consumer in my GStreamer pipelines starts with a queue configured as queue max-size-buffers=4 leaky=downstream flush-on-eos=TRUE.

So far, I cannot find a way to trace which buffer is being held or released too late, and I suspect it may be a buffer lifetime / leak issue in Argus on this older release.

Questions:

  1. Is this a known Argus/DMA-BUF issue in L4T R32.4.4 / JetPack 4.4.1?

  2. Are there recommended workarounds besides upgrading (e.g., GStreamer pipeline tweaks, Argus config changes, consumer queue settings, CMA tuning, etc.)?

  3. How can I get more detailed debug information about Argus buffer management on this release?

Any pointers, release notes, or forum links would be very helpful.

Thanks!

Apply the patch form below link to try.

[nvarguscamerasrc] patch for fixing memory leak
https://forums.developer.nvidia.com/t/160811/6

Hello Shane,

Thanks I applied the patch and install the .so

The pipeline looks bit less stable (I have more crushes).
And in the nvargus still outputs when stream crashes.

Wrong frequency range!
Wrong frequency range!

NVMAP_IOC_WRITE failed: Interrupted system call

(payload:1): GStreamer-CRITICAL **: 08:14:23.862: gst_mini_object_unlock: assertion '(state & access_mode) == access_mode' failed
nvbuf_utils: dmabuf_fd 1064 mapped entry NOT found
nvbuf_utils: Can not get HW buffer from FD... Exiting...
NvBufferGetParams failed for src_dmabuf_fds[0] 
nvbuffer_composite Failed

Dmesg output looks still same.

Thanks for the help.

What’s the command to run the camera pipeline.

We run pipeline from cpp sources. Its relatively complex pipeline with several camera sources and several sinks (udp, file, ros) which are dynamically changing the pipeline based on user settings.
So sorry I can’t provide you simple gst-lunch command.

This patch should be applied on gstnvarguscamerasrc.cpp. In our pipeline we have following components:
-GstNvArgusCameraSrc
-GstCapsFilter
-GstTee
-GstAppSrc
-Gstnvvconv
-GstFakeSink
-GstQueue
-GstVideoRate
-Rosimagesink
-GstNVCompositor
-GstOMXH264Enc-omxh264enc
-MpegTsMux
-GstUDPSink

Could it be that the other component of the pipeline is causing the problem with buffer? Are you aware about similar issue in other components (eg GstNVCompositor)?

Boos the system to try.

sudo nvpmodel -m 0
sudo jetson_clocks
sudo su
echo 1 > /sys/kernel/debug/bpmp/debug/clk/vi/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/isp/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/nvcsi/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/emc/mrq_rate_locked
cat /sys/kernel/debug/bpmp/debug/clk/vi/max_rate |tee /sys/kernel/debug/bpmp/debug/clk/vi/rate
cat /sys/kernel/debug/bpmp/debug/clk/isp/max_rate | tee  /sys/kernel/debug/bpmp/debug/clk/isp/rate
cat /sys/kernel/debug/bpmp/debug/clk/nvcsi/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/nvcsi/rate
cat /sys/kernel/debug/bpmp/debug/clk/emc/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/emc/rate

Hey, thanks.
I was already using sudo nvpmodel -m 0
On Jetson Nano I don’t see bpmp folder so I run.

root@jetson:/home/nano# sudo cat /sys/kernel/debug/clk/clk_summary | egrep "vi|isp|nvcsi|emc"

   clock                                           enable_cnt  prepare_cnt        rate    req_rate   accuracy   phase
----------------------------------------------------------------------------------------------------------------------
 vimclk_sync                                                0            0    24576000    24576000          0 0  
 pd2vi                                                      0            0           0           0          0 0  
          emc                                               3            3  1600000000           0          0 0  
             emc_master                                     2            2  1600000000  1600000000          0 0  
                bwmgr.emc                                   1            1  1600000000  1600000000          0 0  
                override.emc                                3            3  1600000000  1600000000          0 0  
          vii2c                                             2            2    81600000    83200000          0 0  
          vi_sensor                                         0            0   408000000   408000000          0 0  
          vi_sensor2                                        0            0   408000000   408000000          0 0  
                vii2c.host1x                                0            0    81600000   163200000          0 0  
                vi.host1x                                   0            0    81600000   163200000          0 0  
          vic03                                             1            1   486400000   486400000          0 0  
             vic.floor.cbus                                 1            1   486400000           0          0 0  
             vic03.cbus                                     1            1   486400000   486400000          0 0  
          isp                                               3            3   793600000   793600000          0 0  
             ispb                                           1            1   793600000    19200000          0 0  
             ispa                                           1            1   793600000    19200000          0 0  
          vi                                                2            2   793600000   793600000          0 0  
             vi_output                                      0            0   793600000           0          0 0  
             isp.cbus                                       2            2   793600000   307200000          0 0  
                ispb.isp.cbus                               1            1   793600000           1          0 0  
                ispa.isp.cbus                               1            1   793600000           1          0 0  
             vi.cbus                                        1            1   793600000   307200000          0 0  
                vi_bypass.cbus                              0            0   793600000   307200000          0 0  
                vi_v4l2.cbus                                1            1   793600000  1000000001          0 0  
       vim2_clk                                             0            0    19200000    19200000          0 0  
       disp2                                                0            0    19200000    19200000          0 0  
       disp1                                                0            0    19200000    19200000          0 0  
          vic03                                             1            1   307200000   307200000          0 0  
             vic.floor.cbus                                 1            1   307200000           0          0 0  
             vic03.cbus                                     1            1   307200000   307200000          0 0  
          isp                                               3            3   793600000   793600000          0 0  
             ispb                                           1            1   793600000    19200000          0 0  
             ispa                                           1            1   793600000    19200000          0 0  
          vi                                                2            2   793600000   793600000          0 0  
             vi_output                                      0            0   793600000           0          0 0  
             isp.cbus                                       2            2   793600000   307200000          0 0  
                ispb.isp.cbus                               1            1   793600000           1          0 0  
                ispa.isp.cbus                               1            1   793600000           1          0 0  
             vi.cbus                                        1            1   793600000   307200000          0 0  
                vi_bypass.cbus                              0            0   793600000   307200000          0 0  
                vi_v4l2.cbus                                1            1   793600000  1000000001          0 0  
       vim2_clk                                             0            0    19200000    19200000          0 0  
       disp2                                                0            0    19200000    19200000          0 0  
       disp1                                                0            0    19200000    19200000          0 0  

Not sure if it’s helpful, but I noticed that vic03, vic.floor.cbus, vic03.cbus was changing.

The stream was still crashing with same error.

Maybe break down the pipeline to narrow down which element cause the problem.

The issue is present when we add second HD camera.
If we run 4K@30FPS and one HD@10FPS it’s okay. But when we add second HD@10FPS , after some time we get Can not get HW buffer from FD… But it’s not immediate it’s after start of the stream, it takes several minutes. Also The error happens with all three cameras when we are changing the pipeline in runtime.

Thanks for the help

Can 4K down grade to HD to verify if bandwidth issue?

Hey Shane,
thanks for the suggestion, it would be bit more complex for us to modify the driver and dts + whole pipeline to downgrade 4K to FullHD.

That’s why instead we tried to modified the pipeline. Surprisingly after removing GstNVCompositor from the pipeline. We did not observe crash of the stream Can not get HW buffer from FD... Exiting....

This is the part of our pipeline which we removed.

  • Did we configured something wrongly?
  • Are there reported with dmabuf_fd due to NVCompositor usage? Is there some patch for

Thanks in for the help

Please try below solution.

Thanks Shane,
I tried but after I enabled NVCompositor, pipeline was again crashing. (without Compositor it looks stable)

But this time I god the large log in dmesg: dmesg.txt (121.5 KB)

Give it a try for below patch.

Thanks Shane,
I would like to give it a try, but I’m running 32.4.4 and for that version nvcompositor sources are not public.

The nvcompositor plugin is open source from r32.5.1.

Could I please ask you to build .so for the 32.4.4?

Could you upgrade to latest release.

Hi, we tried that but our system didn’t work properly.
Could you please provide build for 32.4.4.

Thanks

Maybe try 32.5.x that similar with 32.4.4