Skip to content

Fix macOS ARM64 segfault in EmbeddingInferencer#381

Open
guy-singer wants to merge 2 commits intomainfrom
claude/fix-macos-arm64-segfault-MGSmG
Open

Fix macOS ARM64 segfault in EmbeddingInferencer#381
guy-singer wants to merge 2 commits intomainfrom
claude/fix-macos-arm64-segfault-MGSmG

Conversation

@guy-singer
Copy link
Copy Markdown
Contributor

@guy-singer guy-singer commented Feb 18, 2026

root cause addressed:

Fix vector_search() passing non-contiguous array to C++ - Line 2284
created img_arr via np.ascontiguousarray() but then passed the
original vec to the native function. On ARM64 with stricter memory
alignment requirements this causes a segfault. Now passes img_arr.

https://claude.ai/code/session_01PgfX2eyWURkx9NWvDnqtJm


Note

Low Risk

Overview
Fixes a native bridge bug in vector_search() by passing the contiguous np.float32 buffer (img_arr) to dll.vector_search instead of the original potentially non-contiguous vec, preventing alignment-related segfaults.

Written by Cursor Bugbot for commit 8b4346b. This will update automatically on new commits. Configure here.

Three root causes addressed:

1. Create missing utilities.py module - The module was imported by
   __init__.py, fastdup_controller.py, galleries.py, html_writer.py,
   and model files but did not exist. This provides is_macos_intel(),
   is_python_3_8(), dcheck_latest_version(), find_model_path() (with
   high_accuracy support), and shared constants (_DOC_MSG,
   _POST_RUN_MSG, _GETTING_STARTED_LINK, GITHUB_URL).

2. Fix vector_search() passing non-contiguous array to C++ - Line 2284
   created img_arr via np.ascontiguousarray() but then passed the
   original vec to the native function. On ARM64 with stricter memory
   alignment requirements this causes a segfault. Now passes img_arr.

3. Set KMP_DUPLICATE_LIB_OK on macOS before loading native library -
   When numpy/scipy/torch each bundle their own libomp, the duplicate
   OpenMP runtime causes an abort (documented in INSTALL.md). This is
   especially common on ARM64 Apple Silicon.

https://claude.ai/code/session_01PgfX2eyWURkx9NWvDnqtJm
The utilities module is provided by a different repository and should
not be duplicated here.

https://claude.ai/code/session_01PgfX2eyWURkx9NWvDnqtJm
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.

2 participants