Reproduction
pip install chdb ray
python -c 'import ray; import chdb; print("ok")'
Result on Linux:
free(): invalid pointer
IOT instruction (core dumped)
Exit code 134 (SIGABRT). Reversing the import order (import chdb; import ray) works.
Cause
_chdb.abi3.so (linked against libc++) and ray._raylet.so (linked against libstdc++) both expose weak C++ runtime symbols (operator new / operator delete / std::string internals). When ray loads first, its libstdc++ wins the global symbol slot; chdb's later allocations and frees then cross allocator boundaries and corrupt the heap.
chdb-core 26.3.0 ships a RTLD_DEEPBIND preload in its own chdb/__init__.py that isolates chdb's symbol scope. But the chdb wrapper wheel also ships a chdb/__init__.py, which pip installs second and overwrites chdb-core's version — the preload never runs in real installs.
Fix
Mirror the same RTLD_DEEPBIND preload into the chdb wrapper's __init__.py so it survives the install-time overwrite.
Environment
- chdb 4.1.7, chdb-core 26.3.0, ray 2.55.1
- Linux x86_64
Reproduction
pip install chdb ray python -c 'import ray; import chdb; print("ok")'Result on Linux:
Exit code 134 (SIGABRT). Reversing the import order (
import chdb; import ray) works.Cause
_chdb.abi3.so(linked against libc++) andray._raylet.so(linked against libstdc++) both expose weak C++ runtime symbols (operator new/operator delete/ std::string internals). When ray loads first, its libstdc++ wins the global symbol slot; chdb's later allocations and frees then cross allocator boundaries and corrupt the heap.chdb-core 26.3.0 ships a
RTLD_DEEPBINDpreload in its ownchdb/__init__.pythat isolates chdb's symbol scope. But thechdbwrapper wheel also ships achdb/__init__.py, which pip installs second and overwrites chdb-core's version — the preload never runs in real installs.Fix
Mirror the same
RTLD_DEEPBINDpreload into the chdb wrapper's__init__.pyso it survives the install-time overwrite.Environment