You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
musllinux wheel fails to load on Alpine: “initial-exec TLS resolves to dynamic definition” when importing cachebox #41
Importing cachebox v5.2.0 inside an Alpine (musl) container raises an error:
ImportError: Error relocating /venv/lib/python3.12/site-packages/cachebox/_core.cpython-312-x86_64-linux-musl.so: (null): initial-exec TLS resolves to dynamic definition in /venv/lib/python3.12/site-packages/cachebox/_core.cpython-312-x86_64-linux-musl.so
Some initial workarounds I already tested
Same application loads fine on Debian-based container base image.
Reverting to an earlier version (e.g., v5.1.0) of cachebox avoids the error on Alpine.
Environment
Base image: python:3.12-alpine (musl libc)
Python: 3.12
cachebox: 5.2.0 (wheel from PyPI)
Package with the cachebox dependency: openfeature-provider-flagd v0.2.6
Details
From the cachebox v.5.2.0 release changelog we can see:
Starting now, cachebox uses mimalloc as the default allocator for some targets ( thanks to @chirizxc, #37)
Mimalloc’s TLS model (initial-exec) is known to break with musl when the library is dlopened; upstream recommends rebuilding with -DMI_LOCAL_DYNAMIC_TLS=ON or switching to the local-dynamic model.
Summary
The published cachebox v5.2.0 wheel seems to fail consistently on the Alpine-based image.
Would it be possible to disable the mimalloc feature for musllinux wheels or adjust the mimalloc build flags so the extension can load on musl?
Activity
chirizxc commentedon Dec 30, 2025
seems need to add
local_dynamic_tlsawolverp commentedon Dec 31, 2025
Thank you for reporting ❤️ It will be fixed now
chirizxc commentedon Dec 31, 2025
@awolverp Should we add tests for this?
https://github.com/lava-sh/toml-rs/blob/main/.github%2Fworkflows%2Fci.yml#L158-L186
chirizxc commentedon Dec 31, 2025
5.2.0
chirizxc commentedon Dec 31, 2025
5.2.1