Comfy-Org / Comfy-Org/Nvidia_RTX_Nodes_ComfyUI
nvvfx bundled libcudnn.so.9 (9.7.1 shim, no sub-libraries) is loaded RTLD_GLOBAL and aborts any later cuDNN consumer (onnxruntime / DWPose) — same class as #34
- Dominant language
- Python
- Stars
- 620
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
## Symptom
With this node pack installed, any custom node that binds to cuDNN **after** ComfyUI startup crashes the whole process. First victim here: `comfyui_controlnet_aux` DWPose, whose onnxruntime CUDA session is created lazily on first use:
```
DWPose: Caching ONNXRuntime session yolox_l.onnx...
Unable to load any of {libcudnn_ops.so.9.7.1, libcudnn_ops.so.9.7, libcudnn_ops.so.9, libcudnn_ops.so}
Invalid handle. Cannot load symbol cudnnCreateFilterDescriptor
Fatal Python error: Aborted
```
ComfyUI dies (SIGABRT), the in-memory history is lost. Note the version in the message: **9.7.1** is neither the cuDNN torch ships (9.19 / 9.20) nor anything else in the venv. It is the version of the shim that ends up being called.
## Root cause
`nvvfx/_lib_loader.py` (nvidia-vfx 0.1.0.1) does, at import time:
```python
for lib_name in _LINUX_LIBS: # includes "libcudnn.so.9"
ctypes.CDLL(str(lib_path), mode=ctypes.RTLD_GLOBAL)
```
`nvvfx/libs/libcudnn.so.9` is a cuDNN 9.7.1 **shim** (125 KB) shipped **without** its sub-libraries (`libcudnn_ops`, `libcudnn_graph`, ...). Torch loads its own cuDNN with `RTLD_LOCAL`, so it is not in the global symbol scope. Anything loaded after `import nvvfx` (onnxruntime's CUDA provider, or any other cuDNN user) resolves `cudnnCreate*` through the global scope, hits the 9.7.1 shim, which then tries to dlopen `libcudnn_ops.so.9.7.1`, fails, and aborts.
This is the same mechanism as #34 (bundled `libnvinfer.so.10` 10.9.0 loaded first, breaking TensorRT 10.12 builders), with cuDNN instead of TensorRT.
## Minimal reproduction (outside ComfyUI)
```python
import torch, onnxruntime as ort # OK: CUDAExecutionProvider session works
import torch, nvvfx, onnxruntime as ort # abort on ort.InferenceSession(..., providers=["CUDAExecutionProvider"])
```
Environment: Ubuntu, RTX 5060 Ti, torch 2.12.0+cu132 (nvidia-cudnn-cu13 9.20), onnxruntime-gpu 1.24.4, nvidia-vfx 0.1.0.1, ComfyUI v0.34, this pack at 892515e.
## Workaround that works
Removing the bundled shim makes the VFX libraries resolve `libcudnn.so.9` against the cuDNN already loaded by torch:
```
mv site-packages/nvvfx/libs/libcudnn.so.9 site-packages/nvvfx/libs/libcudnn.so.9.disabled
```
Verified after that: onnxruntime CUDA sessions work, DWPose works, and `RTXVideoSuperResolution` still runs fine on the torch cuDNN (full VSR runs, 1080p, ULTRA).
## Suggested fix
Either do not bundle `libcudnn.so.9` in the `nvidia-vfx` wheel (torch always provides one), or ship the complete cuDNN (shim + sub-libraries), or load the bundled libraries without `RTLD_GLOBAL` so they cannot shadow the environment's own cuDNN / TensorRT for other nodes. I understand the wheel is NVIDIA's rather than this repo's, but this repo is where users hit it.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with nvvfx/_lib_loader.py and the bundled nvvfx/libs/libcudnn.so.9; reproduce the import-order failure using the minimal torch/onnxruntime/nvvfx example. Compare the loading behavior with #34 and verify a fix by confirming ONNXRuntime CUDA sessions and DWPose work without breaking RTXVideoSuperResolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100