Skip to content

Fix pre-load _chdb.abi3.so with RTLD_DEEPBIND to avoid host libstdc++ conflicts#572

Merged
auxten merged 1 commit into
chdb-io:mainfrom
wudidapaopao:fix_import_ray
May 21, 2026
Merged

Fix pre-load _chdb.abi3.so with RTLD_DEEPBIND to avoid host libstdc++ conflicts#572
auxten merged 1 commit into
chdb-io:mainfrom
wudidapaopao:fix_import_ray

Conversation

@wudidapaopao

Copy link
Copy Markdown
Contributor

Fixes #571.

import ray; import chdb on Linux + Python 3.11/3.12 aborts with free(): invalid pointer because the chdb wrapper's __init__.py overwrites chdb-core's at install time and drops the RTLD_DEEPBIND preload. This PR restores it here.

Changes

  • chdb/__init__.py: add _preload_chdb_with_deepbind(), invoked before from . import _chdb.
  • datastore/tests/test_import_crossstl_isolation.py: 3 subprocess-based regression tests (import ray; import chdb, reverse order, and a query smoke check).
  • .github/workflows/build_linux_{x86,arm64}_wheels*.yml: install ray so the new tests aren't silently skipped.

Verification

Locally on Python 3.12 + chdb-core 26.3.0 + ray 2.55.1, Linux x86_64:

  • Pre-fix: exit 134 / free(): invalid pointer.
  • Post-fix: all three orders (ray;chdb, chdb;ray, ray;chdb+query) exit 0, query returns the expected value.
  • Sanity check: temporarily reverting the preload call makes the new tests fail with SIGABRT, confirming they catch the bug.

…+ conflicts

Prevents `free(): invalid pointer` SIGABRT when `import ray` precedes `import chdb` on Linux (Python 3.11/3.12).
@wudidapaopao wudidapaopao changed the title fix: pre-load _chdb.abi3.so with RTLD_DEEPBIND to avoid host libstdc++ conflicts Fix pre-load _chdb.abi3.so with RTLD_DEEPBIND to avoid host libstdc++ conflicts May 19, 2026
@auxten auxten merged commit 271fd4d into chdb-io:main May 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

import chdb after import ray aborts with 'free(): invalid pointer' on Linux

2 participants