Nvarguscamerasrc always fails the first time at boot,

Hello,
I am running Jetpack 4.6 and L4T 32.6.1.
At boot, running a gstreamer pipeline with nvarguscamera src, always fail the first time. Here’s the log :

nvidia@jetson-rogue-carrier:~$ gst-launch-1.0 nvarguscamerasrc sensor-id=1 num-buffers=200 ! 'video/x-raw(memory:NVMM),width=1920,height=1080, format=(string)NV12' ! nvv4l2h264enc bitrate=20000000 ! h264parse ! queue ! qtmux ! filesink location=test.mp4 -e
Setting pipeline to PAUSED ...
Opening in BLOCKING MODE 
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 1920 x 1080 FR = 29,999999 fps Duration = 33333334 ; Analog Gain range min 1,000000, max 31,622776; Exposure Range min 59000, max 33333000;

GST_ARGUS: Running with following settings:
   Camera index = 1 
   Camera mode  = 0 
   Output Stream W = 1920 H = 1080 
   seconds to Run    = 0 
   Frame Rate = 29,999999 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
nvbuf_utils: dmabuf_fd -1 mapped entry NOT found
nvbuf_utils: Can not get HW buffer from FD... Exiting...
CONSUMER: Done Success
Got EOS from element "pipeline0".
Execution ended after 0:00:04.039832960
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
GST_ARGUS: Cleaning up
GST_ARGUS: Done Success
Setting pipeline to NULL ...
Freeing pipeline ...

After it failed once, if I restart the same command it works perfectly :

nvidia@jetson-rogue-carrier:~$ gst-launch-1.0 nvarguscamerasrc sensor-id=1 num-buffers=200 ! 'video/x-raw(memory:NVMM),width=1920,height=1080, format=(string)NV12' ! nvv4l2h264enc bitrate=20000000 ! h264parse ! queue ! qtmux ! filesink location=test.mp4 -e
Setting pipeline to PAUSED ...
Opening in BLOCKING MODE 
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 1920 x 1080 FR = 29,999999 fps Duration = 33333334 ; Analog Gain range min 1,000000, max 31,622776; Exposure Range min 59000, max 33333000;

GST_ARGUS: Running with following settings:
   Camera index = 1 
   Camera mode  = 0 
   Output Stream W = 1920 H = 1080 
   seconds to Run    = 0 
   Frame Rate = 29,999999 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
H264: Profile = 66, Level = 0 
Got EOS from element "pipeline0".
Execution ended after 0:00:08.351023936
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Setting pipeline to NULL ...
Freeing pipeline ...

I can then launch the command again and it works. Only the first time fails.

I have tried to set an infinite timeout like so :

sudo service nvargus-daemon stop
sudo enableCamInfiniteTimeout=1 nvargus-daemon

But then nvarguscamerasrc hangs forever. Any idea how to solve this issue ?
Thanks !

Please confirm by v4l2-ctl at boot.

v4l2-ctl --stream-mmap -c bypass_mode=0

Thanks for the answer. Unfortunately, v4l2-ctl is not found.

$ v4l2-ctl --stream-mmap -c bypass_mode=0
-bash: v4l2-ctl: command not found

Install it by below command.

sudo apt-get update
sudo apt-get install v4l-utils

Thanks for the answer.
When running the command it hangs

$ v4l2-ctl --stream-mmap -c bypass_mode=0

And this is outputted in the UART console :

[   36.696193] tegra194-vi5 15c10000.vi: no reply from camera processor
[   36.696346] tegra194-vi5 15c10000.vi: uncorr_err: request timed out after 2500 ms
[   36.696504] tegra194-vi5 15c10000.vi: err_rec: attempting to reset the capture channel
[   36.699302] Unable to handle kernel NULL pointer dereference at virtual address 00000010
[   36.699471] Mem abort info:
[   36.699558]   ESR = 0x96000005
[   36.699624]   Exception class = DABT (current EL), IL = 32 bits
[   36.699729]   SET = 0, FnV = 0
[   36.699789]   EA = 0, S1PTW = 0
[   36.699851] Data abort info:
[   36.699908]   ISV = 0, ISS = 0x00000005
[   36.699983]   CM = 0, WnR = 0
[   36.700049] user pgtable: 4k pages, 39-bit VAs, pgd = ffffffc7925d4000
[   36.700226] [0000000000000010] *pgd=0000000000000000, *pud=0000000000000000
[   36.700385] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[   36.700493] Modules linked in: bnep fuse overlay zram imx390 max9295 max9296 userspace_alert nvgpu ip_tables x_tables
[   36.700878] CPU: 7 PID: 7305 Comm: vi-output, imx3 Not tainted 4.9.253-tegra #1
[   36.701280] Hardware name: jetson-xavier (DT)
[   36.705672] task: ffffffc7dac68e00 task.stack: ffffffc7c3ddc000
[   36.711625] PC is at _raw_write_lock+0x30/0x58
[   36.715736] LR is at destroy_buffer_table+0x40/0xd8
[   36.720630] pc : [<ffffff8008f53978>] lr : [<ffffff8008b30710>] pstate: 20c00045
[   36.728412] sp : ffffffc7c3ddfc60
[   36.731391] x29: ffffffc7c3ddfc60 x28: 0000000000000000
[   36.737180] x27: 0000000000000000 x26: 0000000000000000
[   36.742598] x25: 0000000000000010 x24: 0000000000000098
[   36.748444] x23: 0000000000000018 x22: ffffff80090abb28
[   36.753625] x21: 0000000000000000 x20: ffffffc786a04c00
[   36.758872] x19: 0000000000000010 x18: 00000000000061fb
[   36.764390] x17: 0000000000000002 x16: 0000000000000003
[   36.770404] x15: 000000000000000c x14: 0000000000000001
[   36.775847] x13: 0000000000000001 x12: 0000000000000400
[   36.781533] x11: 0000000000000400 x10: 0000000000000000
[   36.787222] x9 : ffffffc7c3ddfa70 x8 : 0000000000000000
[   36.793243] x7 : ffffffc786a0a9c0 x6 : ffffffc7b69a5901
[   36.798503] x5 : ffffff800852d8f4 x4 : ffffffbf1eda6950
[   36.804089] x3 : 0000000000000000 x2 : ffffffc7b69a5900
[   36.809427] x1 : 0000000000000000 x0 : 0000000080000000
[   36.814764]
[   36.815915] Process vi-output, imx3 (pid: 7305, stack limit = 0xffffffc7c3ddc000)
[   36.823167] Call trace:
[   36.825712] [<ffffff8008f53978>] _raw_write_lock+0x30/0x58
[   36.830786] [<ffffff8008b30710>] destroy_buffer_table+0x40/0xd8
[   36.836125] [<ffffff8008b230e4>] vi_capture_shutdown+0xd4/0x130
[   36.841983] [<ffffff8008b2373c>] vi_channel_close_ex+0x34/0x88
[   36.847583] [<ffffff8008b24ca0>] vi5_channel_error_recover+0x48/0x1c8
[   36.853278] [<ffffff8008b19cb0>] tegra_channel_error_recover+0x58/0x90
[   36.859414] [<ffffff8008b25578>] tegra_channel_kthread_capture_dequeue+0xf8/0x1a8
[   36.866317] [<ffffff80080db09c>] kthread+0xec/0xf0
[   36.871210] [<ffffff80080838a0>] ret_from_fork+0x10/0x30
[   36.876205] ---[ end trace 558a344b546a9029 ]---
[   36.895182] note: vi-output, imx3[7305] exited with preempt_count 1

After CTRL+C, in the UART console:

[  209.006246] WARNING: CPU: 1 PID: 7303 at /root/trunk_t186_t194_32.6.1/Linux_for_Tegra/sources/kernel/kernel-4.9/drivers/media/v4l2-core/videobuf2-core.c:1664 __vb2_queue_cancel+0x11c/0x188
[  209.006556] Modules linked in: bnep fuse overlay zram imx390 max9295 max9296 userspace_alert nvgpu ip_tables x_tables
[  209.006946]
[  209.007047] CPU: 1 PID: 7303 Comm: v4l2-ctl Tainted: G      D         4.9.253-tegra #1
[  209.007198] Hardware name: jetson-xavier (DT)
[  209.007288] task: ffffffc78c772a00 task.stack: ffffffc78c77c000
[  209.007408] PC is at __vb2_queue_cancel+0x11c/0x188
[  209.007505] LR is at __vb2_queue_cancel+0x34/0x188
[  209.007604] pc : [<ffffff8008b0ee5c>] lr : [<ffffff8008b0ed74>] pstate: 20400045
[  209.007752] sp : ffffffc78c77fae0
[  209.007828] x29: ffffffc78c77fae0 x28: ffffffc78c772a00
[  209.008175] x27: ffffff8008f62000 x26: ffffffc79ebd39c0
[  209.008615] x25: ffffffc79ea6d468 x24: ffffffc7c5a55ae8
[  209.009048] x23: 0000000000000000 x22: ffffffc7c6100018
[  209.010643] x21: ffffffc7dad32800 x20: ffffffc7c61005d0
[  209.016132] x19: ffffffc7c61005d0 x18: 0000000000000000
[  209.021908] x17: 0000007f9bec4960 x16: 0000000000000000
[  209.027421] x15: ffffff800a21de10 x14: 0000000000000001
[  209.033107] x13: 0000000000000389 x12: 071c71c71c71c71c
[  209.038795] x11: 000000000000000b x10: 0000000000000a10
[  209.044399] x9 : ffffffc78c77f1d0 x8 : ffffffc7dab34a98
[  209.050171] x7 : ffffffc7dab34aa8 x6 : ffffffc7ffce25e0
[  209.055445] x5 : 0000000000000001 x4 : ffffffc7dac6e200
[  209.061029] x3 : ffffff8009535a28 x2 : ffffffc78c772a00
[  209.066359] x1 : ffffffc7da4cb890 x0 : 0000000000000004
[  209.071694]
[  209.072842] ---[ end trace 558a344b546a902a ]---
[  209.077568] Call trace:
[  209.079768] [<ffffff8008b0ee5c>] __vb2_queue_cancel+0x11c/0x188
[  209.085448] [<ffffff8008b1029c>] vb2_core_queue_release+0x2c/0x58
[  209.091221] [<ffffff8008b1291c>] _vb2_fop_release+0x84/0xa0
[  209.096564] [<ffffff8008b184cc>] tegra_channel_close+0x64/0x140
[  209.102163] [<ffffff8008aebce8>] v4l2_release+0x48/0xa0
[  209.106981] [<ffffff800825dcb8>] __fput+0x90/0x1d0
[  209.111785] [<ffffff800825de70>] ____fput+0x20/0x30
[  209.116342] [<ffffff80080d8dac>] task_work_run+0xbc/0xd8
[  209.121414] [<ffffff80080b8408>] do_exit+0x2e0/0xa88
[  209.126131] [<ffffff80080b8c40>] do_group_exit+0x40/0xa8
[  209.130956] [<ffffff80080c64ec>] get_signal+0xbc/0x750
[  209.135677] [<ffffff800808add8>] do_signal+0x130/0x500
[  209.140836] [<ffffff800808b320>] do_notify_resume+0x90/0xb0
[  209.146695] [<ffffff800808379c>] work_pending+0x8/0x10

Thanks for the help.

Looks like could be the sensor driver problem, it could be the sensor need done something then second time able worked.

How about run v4l2-ctl second third times?

What can I do here there ? And which driver ?

The command v4l2-ctl --stream-mmap -c bypass_mode=0 hangs, and does not recover after CTRL+C. I have to power cycle to board.

I would suggest consult with the vendor for the driver.

I have contacted the vendor. Any other debug steps I could perform to get a better understanding of the problem ?
I know that the deserializer is Maxim MAX9296A and it is connected via the camera connection header.