Problem
Decord uses ctypes.RTLD_GLOBAL when loading libdecord.so, which exports all symbols (including FFmpeg/libav) into the global namespace. This causes symbol conflicts with other libraries that use similar dependencies, leading to crashes.
Minimal Reproduction
import decord
import wgpu
adapter = wgpu.gpu.request_adapter_sync()
Segmentation fault (core dumped)
Expected behavior:
Both libraries work together without crashes.
Root Cause
The issue is in python/decord/_ffi/base.py:39:
def _load_lib():
"""Load libary by searching possible path."""
lib_path = libinfo.find_lib_path()
os.environ['PATH'] += os.pathsep + os.path.dirname(lib_path[0])
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_GLOBAL) # <---
# DMatrix functions
lib.DECORDGetLastError.restype = ctypes.c_char_p
return lib, os.path.basename(lib_path[0])
Additional Context
- Platform: Linux
- Python: 3.13
- Decord: Latest from pip
- Other library tested: wgpu
Problem
Decord uses
ctypes.RTLD_GLOBALwhen loadinglibdecord.so, which exports all symbols (including FFmpeg/libav) into the global namespace. This causes symbol conflicts with other libraries that use similar dependencies, leading to crashes.Minimal Reproduction
Expected behavior:
Both libraries work together without crashes.
Root Cause
The issue is in
python/decord/_ffi/base.py:39:Additional Context