nvargus-daemon crash on simultaneous use of Argus camera and USB camera

Hi all,

I am trying to use a Realsense D435 and the Jetson onboard camera simultaneously. Whenever the Realsense USB camera is plugged in, I get a crash when trying to use the onboard camera via Argus. This happens even when I just run an Argus sample app and not even trying to use the Realsense camera.

Found some older posts with similar issues. Some patches were provided but only for older L4T versions. I am seeing this problem with Jetpack 4.2 (L4T 32.1). It seems that whenever there is a /dev/videoX is present that is not a MIPI camera this crash happens. Does anyone know a workaround for this issue?

Older post on this topic: https://devtalk.nvidia.com/default/topic/1043277/argus-error-initializing-camera-provider/

Example crash (10_camera_recording):

Set governor to performance before enabling profiler
[65743.893393] audit: type=1701 audit(1565283377.862:6): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=4439 comm="nvargus-daemon" exe="/usr/sbin/nvargus-daemon" sig=11
(Argus) Error EndOfFile: Unexpected error in reading socket (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 266)
(Argus) Error EndOfFile: Receive worker failure, notifying 1 waiting threads (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 340)
(Argus) Error EndOfFile: Client thread received an error from socket (in src/rpc/socket/client/ClientSocketManager.cpp, function send(), line 145)
(Argus) Error InvalidState: Argus client is exiting with 1 outstanding client threads (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 357)
(Argus) Error EndOfFile: Receiving thread terminated with error (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadWrapper(), line 368)
(Argus) Error EndOfFile:  (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function dispatch(), line 87)
(Argus) Error InvalidState: Receive thread is not running cannot send. (in src/rpc/socket/client/ClientSocketManager.cpp, function send(), line 96)
(Argus) Error InvalidState:  (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function dispatch(), line 87)
Error generated. main.cpp, execute:486 Failed to create CameraProvider
(Argus) Error InvalidState: Receive thread is not running cannot send. (in src/rpc/socket/client/ClientSocketManager.cpp, function send(), line 96)
(Argus) Error InvalidState:  (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function dispatch(), line 87)

journactl -u nvargus-daemon output:

Aug 07 22:40:46 jetson-tx2 systemd[1]: Started NVIDIA Argus daemon.
Aug 08 16:56:17 jetson-tx2 nvargus-daemon[4439]: === NVIDIA Libargus Camera Service (0.97.3)=== Listening for connections...=== camer
a_recording[30707]: Connection established (7F82FEF1C0)OFParserGetVirtualDevice: virtual device driver node not found in proc device-
tree: /proc/device-tree/tegra-virtual-camera-platform/modules/module0/drivernode1
Aug 08 16:56:17 jetson-tx2 nvargus-daemon[4439]: OFParserGetVirtualDevice: virtual device driver node not found in proc device-tree: 
/proc/device-tree/tegra-virtual-camera-platform/modules/module1/drivernode0
Aug 08 16:56:17 jetson-tx2 nvargus-daemon[4439]: ---- imager: No override file found. ----
Aug 08 16:56:17 jetson-tx2 nvargus-daemon[4439]: ---- imager: No override file found. ----
Aug 08 16:56:17 jetson-tx2 nvargus-daemon[4439]: initializeDevNode: Failed to open dev node '/dev/camera/video1'; No such file or dir
ectory, trying alternate default location
Aug 08 16:56:17 jetson-tx2 nvargus-daemon[4439]: (NvCamV4l2) Error BadParameter: Control 10094858 not found (in /dvs/git/dirty/git-ma
ster_linux/camera/utils/nvcamv4l2/v4l2_device.cpp, function findControlById(), line 1874)
Aug 08 16:56:17 jetson-tx2 nvargus-daemon[4439]: (NvCamV4l2) Error BadParameter:  (propagating from /dvs/git/dirty/git-master_linux/c
amera/utils/nvcamv4l2/v4l2_device.cpp, function getControlRange(), line 331)
Aug 08 16:56:17 jetson-tx2 nvargus-daemon[4439]: initialize: focus query failed
Aug 08 16:56:17 jetson-tx2 systemd[1]: [[0;1;39m[[0;1;31m[[0;1;39mnvargus-daemon.service: Main process exited, code=killed, status=11
/SEGV[[0m
Aug 08 16:56:17 jetson-tx2 systemd[1]: [[0;1;39m[[0;1;31m[[0;1;39mnvargus-daemon.service: Failed with result 'signal'.[[0m
Aug 08 16:56:18 jetson-tx2 systemd[1]: nvargus-daemon.service: Service RestartSec=100ms expired, scheduling restart.
Aug 08 16:56:18 jetson-tx2 systemd[1]: nvargus-daemon.service: Scheduled restart job, restart counter is at 1.
Aug 08 16:56:18 jetson-tx2 systemd[1]: Stopped NVIDIA Argus daemon.
Aug 08 16:56:18 jetson-tx2 systemd[1]: Started NVIDIA Argus daemon.

It’s know issue for some USB camera.
Did you working with latest BSP(J4.2.x)?

@ShaneCCC I am using Jetpack 4.2, it would be a considerable amount of work for me to move to Jetpack 4.2.1. Before I do, can you confirm that this issue has been fixed in 4.2.1? I didn’t see anything about it in the release notes.

@kryhorchuk
Sorry to tell it’s not fixed in J4.2.1 too.

@kryhorchuk
Please have replace the /usr/lib/aarch64-linux-gnu/tegra/libargus.so by the attached to try.

Note: rename the sub file name from .txt to .so

libnvargus.txt (946 KB)

@ShaneCCC

Results not good. The patch works some of the time, but mostly it does not. I’m not sure if the situation has improved since I was not really trying as hard to make it work before. Logs do not look significantly different.

One thing that is different: camera_recording segfaults on exit now too, even if I don’t have the USB camera attached :-(

Do I need to replace nvargus-daemon too? That is what appears to be crashing. Keep sending stuff, I will keep trying.

Console logs:

Set governor to performance before enabling profiler
(Argus) Error EndOfFile: Unexpected error in reading socket (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 266)
(Argus) Error EndOfFile: Receive worker failure, notifying 1 waiting threads (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 340)
(Argus) Error InvalidState: Argus client is exiting with 1 outstanding client threads (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 357)
(Argus) Error EndOfFile: Receiving thread terminated with error (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadWrapper(), line 368)
(Argus) Error EndOfFile: Client thread received an error from socket (in src/rpc/socket/client/ClientSocketManager.cpp, function send(), line 145)
(Argus) Error EndOfFile:  (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function dispatch(), line 87)
(Argus) Error InvalidState: Receive thread is not running cannot send. (in src/rpc/socket/client/ClientSocketManager.cpp, function send(), line 96)
(Argus) Error InvalidState:  (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function dispatch(), line 87)
Error generated. main.cpp, execute:486 Failed to create CameraProvider
(Argus) Error InvalidState: Receive thread is not running cannot send. (in src/rpc/socket/client/ClientSocketManager.cpp, function send(), line 96)
(Argus) Error InvalidState:  (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function dispatch(), line 87)

Logs from nvargus-daemon:

Aug 15 17:45:11 jetson-tx2 systemd[1]: Started NVIDIA Argus daemon.
Aug 15 17:45:50 jetson-tx2 nvargus-daemon[4354]: === NVIDIA Libargus Camera Service (0.97.3)=== Listening for connections...=== cam
era_recording[4758]: Connection established (7FB1F411C0)OFParserGetVirtualDevice: virtual device driver node not found in proc devi
ce-tree: /proc/device-tree/tegra-virtual-camera-platform/modules/module0/drivernode1
Aug 15 17:45:50 jetson-tx2 nvargus-daemon[4354]: OFParserGetVirtualDevice: virtual device driver node not found in proc device-tree
: /proc/device-tree/tegra-virtual-camera-platform/modules/module1/drivernode0
Aug 15 17:45:50 jetson-tx2 nvargus-daemon[4354]: ---- imager: No override file found. ----
Aug 15 17:46:10 jetson-tx2 nvargus-daemon[4354]: === camera_recording[4758]: CameraProvider initialized (0x7fac6d9900)=== camera_re
cording[4758]: Connection closed (7FB1F411C0)=== camera_recording[4758]: WARNING: CameraProvider was not destroyed before client co
nnection terminated.=== camera_recording[4758]:          The client may have abnormally terminated. Destroying CameraProvider...===
 camera_recording[4758]: CameraProvider destroyed (0x7fac6d9900)=== camera_recording[4758]: WARNING: Cleaning up 10 outstanding buf
fers...=== camera_recording[4758]: WARNING: Cleaning up 1 outstanding buffer settings...=== camera_recording[4758]: WARNING: Cleani
ng up 1 outstanding stream settings...=== camera_recording[4758]: WARNING: Cleaning up 1 outstanding sessions...=== camera_recordin
g[4758]: NOTE: Destroy all libargus objects before destroying the CameraProvider to avoid these warnings.=== camera_recording[4758]
: Connection cleaned up (7FB1F411C0)=== camera_recording[4869]: Connection established (7FB1F411C0)OFParserGetVirtualDevice: virtua
l device driver node not found in proc device-tree: /proc/device-tree/tegra-virtual-camera-platform/modules/module0/drivernode1
Aug 15 17:46:10 jetson-tx2 nvargus-daemon[4354]: OFParserGetVirtualDevice: virtual device driver node not found in proc device-tree
: /proc/device-tree/tegra-virtual-camera-platform/modules/module1/drivernode0
Aug 15 17:46:10 jetson-tx2 nvargus-daemon[4354]: ---- imager: No override file found. ----
Aug 15 17:46:10 jetson-tx2 nvargus-daemon[4354]: ---- imager: No override file found. ----
Aug 15 17:46:10 jetson-tx2 nvargus-daemon[4354]: initializeDevNode: Failed to open dev node '/dev/camera/video1'; No such file or d
irectory, trying alternate default location
Aug 15 17:46:10 jetson-tx2 nvargus-daemon[4354]: (NvCamV4l2) Error BadParameter: Control 10094858 not found (in /dvs/git/dirty/git-
master_linux/camera/utils/nvcamv4l2/v4l2_device.cpp, function findControlById(), line 1874)
Aug 15 17:46:10 jetson-tx2 nvargus-daemon[4354]: (NvCamV4l2) Error BadParameter:  (propagating from /dvs/git/dirty/git-master_linux
/camera/utils/nvcamv4l2/v4l2_device.cpp, function getControlRange(), line 331)
Aug 15 17:46:10 jetson-tx2 nvargus-daemon[4354]: initialize: focus query failed
Aug 15 17:46:10 jetson-tx2 systemd[1]: [[0;1;39m[[0;1;31m[[0;1;39mnvargus-daemon.service: Main process exited, code=killed, status=
11/SEGV[[0m
Aug 15 17:46:10 jetson-tx2 systemd[1]: [[0;1;39m[[0;1;31m[[0;1;39mnvargus-daemon.service: Failed with result 'signal'.[[0m
Aug 15 17:46:10 jetson-tx2 systemd[1]: nvargus-daemon.service: Service RestartSec=100ms expired, scheduling restart.
Aug 15 17:46:10 jetson-tx2 systemd[1]: nvargus-daemon.service: Scheduled restart job, restart counter is at 1.
Aug 15 17:46:10 jetson-tx2 systemd[1]: Stopped NVIDIA Argus daemon.
Aug 15 17:46:10 jetson-tx2 systemd[1]: Started NVIDIA Argus daemon.

camera_recording crash:

./camera_recording 
Set governor to performance before enabling profiler
PRODUCER: Creating output stream
PRODUCER: Launching consumer thread
Failed to query video capabilities: Inappropriate ioctl for device
Opening in BLOCKING MODE 
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
875967048
842091865
create video encoder return true
H264: Profile = 100, Level = 50 
PRODUCER: Starting repeat capture requests.
CONSUMER: Got EOS, exiting...
CONSUMER: Done.
PRODUCER: Done -- exiting.
Segmentation fault

Hi kryhorchuk,

We’re working on a fix for this issue, please stay tuned.

@kryhorchuk
Please have a try the attached lib.
Rename it to libnvodm_imager.so and copy it to /usr/lib/aarch64-linux-gnu/tegra/libnvodm_imager.so
libnvodm_imager_tx2.txt (5.04 MB)

@ShaneCCC, @kayccc,

The libnvodm_imager_tx2 patch appears to work. I’ll let it run overnight and see if it is stable.

There is a deeper issue between librealsense2 and tegra_mmapi that causes a crash when a program that uses both exits. I see it happen simply if I just link in the Argus libraries but do not use them. But that can be a subject for a different thread, if I can confirm the problem.

Have a try apply the patch from below topic.

So this is still happening to me with version 4.4. Any updates on this issue?