Skip to content

Avoid ctypes callbacks when listing libraries on Linux. - #242

Draft
ogrisel wants to merge 1 commit into
joblib:masterfrom
ogrisel:225-avoid-ctypes-callbacks-linux
Draft

Avoid ctypes callbacks when listing libraries on Linux.#242
ogrisel wants to merge 1 commit into
joblib:masterfrom
ogrisel:225-avoid-ctypes-callbacks-linux

Conversation

@ogrisel

@ogrisel ogrisel commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Workaround for #225 on some system:

Importing ctypes.util or using CFUNCTYPE with dl_iterate_phdr creates libffi closures that can abort after fork on some Linux libffi builds. Enumerate libraries from /proc/self/maps and load libc via CDLL(None).

Disclaimer: this PR was vibecoded although I did ask the agent to use a container to check that it actually workaround the problem on AlmaLinux 9.8 (Olive Jaguar) with libffi-3.4.2-8.el9.

Still, I find the extra complexity in threadpoolctl not justified. I would rather wait for upstream ctypes to fix the problem or wait for all impacted linux distributions to upgrade to a newer libffi.

Importing ctypes.util or using CFUNCTYPE with dl_iterate_phdr creates
libffi closures that can abort after fork on some Linux libffi builds.
Enumerate libraries from /proc/self/maps and load libc via CDLL(None).

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant