cudaErrorIllegalAddress Error when using VPI with DeepStream7.1 in Python

• Hardware Platform (Jetson Orin NX)
• DeepStream Version 7.1
• JetPack Version 6.2 [L4T 36.4.3] (super config)

• Issue Type(questions, bugs)

Hi,

This is a re-opening of the previous issue.

I’ve upgraded my Orin NX to JetPack 6.2 with the super config, and repeated the experiment of converting a GStreamer buffer to a VPI Image. I’ve also included the workaround:

But still facing cudaErrorIllegalAddress error, followed by Segmentation fault (core dumped)

• How to reproduce the issue?
Please refer to this Github repository, I’ve updated the repo with DS7.1 Dockerfile, scripts and configs.

Thank you for your assistance!

Hi,

Thanks for reporting this issue.
We will give it a try and provide more info to you later.

Thanks.

Hi,

We test the sample on JetPack 6.2 (r36.4.3) with the deepstream container and it can work correctly.

$ sudo docker build . -t vpi:ds7.1 -f Dockerfile.ds7.1
$ sudo docker run -it --rm --runtime nvidia -v ${PWD}:/app/ -w /app/ vpi:ds7.1 bash
# python3 app_ds7.1.py -i file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h265.mp4
<frozen importlib._bootstrap_external>:1184: FutureWarning: The cuda.cudart module is deprecated and will be removed in a future release, please switch to use the cuda.bindings.runtime module instead.

(gst-plugin-scanner:73): GStreamer-WARNING **: 07:27:42.488: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstpulseaudio.so': libFLAC.so.8: cannot open shared object file: No such file or directory

(gst-plugin-scanner:73): GStreamer-WARNING **: 07:27:42.554: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstsndfile.so': libFLAC.so.8: cannot open shared object file: No such file or directory

(gst-plugin-scanner:73): GStreamer-WARNING **: 07:27:42.560: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstchromaprint.so': libavcodec.so.58: cannot open shared object file: No such file or directory

(gst-plugin-scanner:73): GStreamer-WARNING **: 07:27:42.565: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstmpg123.so': libmpg123.so.0: cannot open shared object file: No such file or directory

(gst-plugin-scanner:73): GStreamer-WARNING **: 07:27:42.672: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstfluidsynthmidi.so': libFLAC.so.8: cannot open shared object file: No such file or directory

(gst-plugin-scanner:73): GStreamer-WARNING **: 07:27:42.696: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstmplex.so': libmjpegutils-2.1.so.0: cannot open shared object file: No such file or directory

(gst-plugin-scanner:73): GStreamer-WARNING **: 07:27:42.706: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstlame.so': libmp3lame.so.0: cannot open shared object file: No such file or directory

(gst-plugin-scanner:73): GStreamer-WARNING **: 07:27:42.707: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstopenmpt.so': libmpg123.so.0: cannot open shared object file: No such file or directory
sh: 1: lsmod: not found
sh: 1: modprobe: not found
(Argus) Error FileOperationFailed: Connecting to nvargus-daemon failed: No such file or directory (in src/rpc/socket/client/SocketClientDispatch.cpp, function openSocketConnection(), line 205)
(Argus) Error FileOperationFailed: Cannot create camera provider (in src/rpc/socket/client/SocketClientDispatch.cpp, function createCameraProvider(), line 107)

(gst-plugin-scanner:73): GStreamer-WARNING **: 07:27:42.793: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstlibav.so': libavcodec.so.58: cannot open shared object file: No such file or directory

(gst-plugin-scanner:73): GStreamer-WARNING **: 07:27:42.795: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_udp.so': librivermax.so.0: cannot open shared object file: No such file or directory

(gst-plugin-scanner:73): GStreamer-WARNING **: 07:27:42.972: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_inferserver.so': libtritonserver.so: cannot open shared object file: No such file or directory
Creating Pipeline 
 
Creating streammux 
 
Creating source_bin  0  
 
Creating source bin
source-bin-00
/app/app_ds7.1.py:346: DeprecationWarning: Gst.Element.get_request_pad is deprecated
  sinkpad = streammux.get_request_pad(padname)
Creating Pgie 
 
Creating nvvidconv1 
 
Creating filter1 
 
Creating tiler 
 
Creating nvvidconv 
 
Creating nvosd 
 
Creating Fakesink 

Adding elements to Pipeline 

Linking elements in the Pipeline 

Now playing...
0 :  file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h265.mp4
Starting pipeline 

Setting min object dimensions as 16x16 instead of 1x1 to support VIC compute mode.
WARNING: Deserialize engine failed because file path: /opt/nvidia/deepstream/deepstream-7.1/samples/models/Primary_Detector/resnet18_trafficcamnet_pruned.onnx_b1_gpu0_int8.engine open error
0:00:00.697953186    43 0xaaaadd89c5b0 WARN                 nvinfer gstnvinfer.cpp:681:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:2080> [UID = 1]: deserialize engine from file :/opt/nvidia/deepstream/deepstream-7.1/samples/models/Primary_Detector/resnet18_trafficcamnet_pruned.onnx_b1_gpu0_int8.engine failed
0:00:00.697985187    43 0xaaaadd89c5b0 WARN                 nvinfer gstnvinfer.cpp:681:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2185> [UID = 1]: deserialize backend context from engine from file :/opt/nvidia/deepstream/deepstream-7.1/samples/models/Primary_Detector/resnet18_trafficcamnet_pruned.onnx_b1_gpu0_int8.engine failed, try rebuild
0:00:00.697998948    43 0xaaaadd89c5b0 INFO                 nvinfer gstnvinfer.cpp:684:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:2106> [UID = 1]: Trying to create engine from model files
0:01:13.167403518    43 0xaaaadd89c5b0 INFO                 nvinfer gstnvinfer.cpp:684:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:2138> [UID = 1]: serialize cuda engine to file: /opt/nvidia/deepstream/deepstream-7.1/samples/models/Primary_Detector/resnet18_trafficcamnet_pruned.onnx_b1_gpu0_int8.engine successfully
Implicit layer support has been deprecated
INFO: [Implicit Engine Info]: layers num: 0

0:01:13.471200162    43 0xaaaadd89c5b0 INFO                 nvinfer gstnvinfer_impl.cpp:343:notifyLoadModelStatus:<primary-inference> [UID 1]: Load new model:dstest_imagedata_cupy_config_ds7.1.txt sucessfully
Decodebin child added: source 

Decodebin child added: decodebin0 


**PERF:  {'stream0': 0.0} 

Decodebin child added: qtdemux0 

Decodebin child added: multiqueue0 

Decodebin child added: h265parse0 

Decodebin child added: capsfilter0 

Warning: gst-stream-error-quark: No decoder available for type 'audio/mpeg, mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, level=(string)2, base-profile=(string)lc, profile=(string)lc, codec_data=(buffer)119056e500, rate=(int)48000, channels=(int)2'. (6): ../gst/playback/gsturidecodebin.c(960): unknown_type_cb (): /GstPipeline:pipeline0/GstBin:source-bin-00/GstURIDecodeBin:uri-decode-bin
sh: 1: lsmod: not found
sh: 1: modprobe: not found
Decodebin child added: nvv4l2decoder0 

Opening in BLOCKING MODE 
NvMMLiteOpen : Block : BlockType = 279 
NvMMLiteBlockCreate : Block : BlockType = 279 
In cb_newpad

1920x1080 Format.RGBA8
960x540 Format.BGR8

**PERF:  {'stream0': 0.0} 

1920x1080 Format.RGBA8
960x540 Format.BGR8
1920x1080 Format.RGBA8
960x540 Format.BGR8
1920x1080 Format.RGBA8
960x540 Format.BGR8
...
1920x1080 Format.RGBA8
960x540 Format.BGR8
nvstreammux: Successfully handled EOS for source_id=0
1920x1080 Format.RGBA8
960x540 Format.BGR8
1920x1080 Format.RGBA8
960x540 Format.BGR8
1920x1080 Format.RGBA8
960x540 Format.BGR8
1920x1080 Format.RGBA8
960x540 Format.BGR8
1920x1080 Format.RGBA8
960x540 Format.BGR8
1920x1080 Format.RGBA8
960x540 Format.BGR8
End-of-stream
Exiting app

Could you try it again to see if there is any difference between us?
Thanks.

I still got the error, here’s the log:

...
960x540 Format.BGR8
1920x1080 Format.RGBA8
960x540 Format.BGR8
1920x1080 Format.RGBA8
960x540 Format.BGR8
1920x1080 Format.RGBA8
960x540 Format.BGR8
CUDA Runtime error cudaMemcpyAsync(device_, host_, bytes(), cudaMemcpyHostToDevice, stream) # an illegal memory access was encountered, code = cudaErrorIllegalAddress [ 700 ] in file /dvs/git/dirty/git-master_linux/deepstream/sdk/src/utils/nvll_osd/memory.hpp:59
CUDA Runtime error cudaMemcpyAsync(device_, host_, bytes(), cudaMemcpyHostToDevice, stream) # an illegal memory access was encountered, code = cudaErrorIllegalAddress [ 700 ] in file /dvs/git/dirty/git-master_linux/deepstream/sdk/src/utils/nvll_osd/memory.hpp:59
CUDA Runtime error cudaMemcpyAsync(device_, host_, bytes(), cudaMemcpyHostToDevice, stream) # an illegal memory access was encountered, code = cudaErrorIllegalAddress [ 700 ] in file /dvs/git/dirty/git-master_linux/deepstream/sdk/src/utils/nvll_osd/memory.hpp:59
[cuOSD Error] at /dvs/git/dirty/git-master_linux/deepstream/sdk/src/utils/nvll_osd/cuda/cuosd_kernel.cu:1072 : Launch kernel (render_elements_kernel) failed, code = 700CUDA Runtime error cudaPeekAtLastError() # an illegal memory access was encountered, code = cudaErrorIllegalAddress [ 700 ] in file /dvs/git/dirty/git-master_linux/deepstream/sdk/src/utils/nvll_osd/cuosd.cpp:968
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[ERROR] 2025-06-02 10:02:00 Error destroying cuda device: ���
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:00 (cudaErrorIllegalAddress)
[ERROR] 2025-06-02 10:02:00 Exiting the Stream worker thread failed with exception: VPI_ERROR_INTERNAL: (cudaErrorIllegalAddress)
[WARN ] 2025-06-02 10:02:01 (cudaErrorIllegalAddress)
[ERROR] 2025-06-02 10:02:01 Error destroying cuda device: ���
[WARN ] 2025-06-02 10:02:01 (cudaErrorIllegalAddress)
...
[WARN ] 2025-06-02 10:02:01 (cudaErrorIllegalAddress)
Segmentation fault (core dumped)

I checked changing vpi.Backend.CUDA to vpi.Backend.VIC, then the error didn’t occur.

Is there any other information I could provide for further debug? Or any libraries that are shared across host and docker that the Jetson is missing?

Thank you!

Hi,

How do you launch the container?

Do you use standard docker with the account belonging to the sudo group?
This will affect the GPU access authority within the container.

Thanks.

Yes, I am using the standard docker with the account belonging to sudo group. Also if GPU is not accessible, nvinfer should fail as well, but it’s not the case.

FYI, here’s my docker version & nvidia-container-cli version:

docker --version
Docker version 27.5.1, build 9f9e405

nvidia-container-cli -V
cli-version: 1.16.2
lib-version: 1.16.2
build date: 2024-09-24T15:26+00:00
build revision: 921e2f3197385173cf8670342e96e98afe9b3dd3
build compiler: aarch64-linux-gnu-gcc-7 7.5.0
build platform: aarch64
build flags: -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -DNDEBUG -std=gnu11 -O2 -g -fdata-sections -ffunction-sections -fplan9-extensions -fstack-protector -fno-strict-aliasing -fvisibility=hidden -Wall -Wextra -Wcast-align -Wpointer-arith -Wmissing-prototypes -Wnonnull -Wwrite-strings -Wlogical-op -Wformat=2 -Wmissing-format-attribute -Winit-self -Wshadow -Wstrict-prototypes -Wunreachable-code -Wconversion -Wsign-conversion -Wno-unknown-warning-option -Wno-format-extra-args -Wno-gnu-alignof-expression -Wl,-zrelro -Wl,-znow -Wl,-zdefs -Wl,--gc-sections

Thank you!

Hi,

Sorry for the late update.
We are checking this with our internal team and will provide more info to you later.

Thanks.

Hi,

As we have a new release recently, could you check if you are seeing the same behavior in JetPack 6.2.1?

Thanks.

Hi,

Thanks for following up!

I could do it later if I have time, as this involves flashing new JetPack and setting up the ORIN again.

Meanwhile, is there any more information after you check with the internal team?

Thank you.

Hi,

Thanks for your feedback.

We have a related fix recently.
Our internal team will test if the fix also helps with this issue when they have bandwidth.

Thanks.

Hi,

Thanks for your patience.

When reviewing this bug, we thought this was an implementation issue instead of a bug.
Based on the sample:

n_frame_gpu = cp.ndarray(
    shape=(height, width, channels),
    dtype=np.uint8,
    memptr=memptr,
    strides=strides,
    order="C",
)

vpi_image = vpi.asimage(n_frame_gpu)
with vpi.Backend.CUDA:
    output = vpi_image.rescale((vpi_image.width // 2, vpi_image.height // 2))
    output = output.convert(vpi.Format.BGR8)
print(f"{vpi_image.width}x{vpi_image.height} {vpi_image.format}")
print(f"{output.width}x{output.height} {output.format}")

It seems that you expect the print of metadata (width x height and format) to sync the output and thus delete n_frame_gpu after printing. But this can cause illegal memory access as vpi_image may still be being read in “with” (async algos of VPI) and deleting the underlying memory of the wrapped vpi_image.

The correct usage is to sync before delete, or delete the wrapped image before deleting the raw buffer n_frame_gpu.

Thanks.