Skip to content

v0.8.0 causing segfault 11 on macOS #207

Closed

Description

@davidmezzetti

What went wrong?

Hello - I just happened to merge in a PR for txtai and now v0.8.0 is failing with segfault for macOS. Not sure what would have changed.

neuml/txtai#1494

How can we reproduce it? (optional)

No response

Environment (optional)

No response

Activity

  1. gouyt13 commented on Nov 1, 2026

    @gouyt13
    Member

    Thanks for the report, and sorry for the breakage.

    Cause: in 0.8.0, IvfIndex.add() defaults to num_threads=0 (all available CPUs); 0.7 defaulted to 1. txtai's append calls add(embeddings), so with 0.8.0 it starts an OpenMP worker team. On macOS, Faiss, PyTorch and rabitqlib each bundle their own libomp. When Faiss and PyTorch are loaded in the same process, starting workers in rabitqlib's runtime crashes with OMP: Error #179: Function pthread_mutex_init failed, followed by a segfault.

    0.8.0 also ignores OMP_NUM_THREADS, so txtai's existing macOS setting (OMP_NUM_THREADS=1) didn't apply. The crash does not reproduce on Linux.

    Fix (#208): 0.8.1 is now on PyPI. It caps num_threads=0 by OMP_NUM_THREADS (omp_get_max_threads()), as Faiss does. With txtai's existing macOS setting, add runs single-threaded again and needs no change on your side. We checked this on a macos-15 arm64 runner with txtai at e5d8d43, running unittest discover -k testann:

    • The 0.8.0 wheel segfaults in testRabitQ.
    • A wheel built from the fix passes all 72 tests.

    You can drop the rabitqlib==0.7.2 pin from your CI. To stay safe on macOS regardless of that environment variable, you can also pass the thread count explicitly, which every 0.7.x and 0.8.x version accepts:

    self.backend.add(embeddings, num_threads=1)
  2. davidmezzetti commented on Nov 1, 2026

    @davidmezzetti
    Author

    Thank you for the quick fix!

  3. added a commit that references this issue on Nov 2, 2026
    005d8c4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions