Commit 824a6dc
fix(vector_io): prevent duplicate libomp crash when importing faiss on macOS (#6304)
# What does this PR do?
Fixes a fatal server crash (OMP Error #15) that occurs on macOS when
faiss and another dependency (e.g. torch, scipy) each load their own
copy of `libomp.dylib`. The fix sets `KMP_DUPLICATE_LIB_OK=TRUE` before
importing faiss, scoped to macOS only via `sys.platform == "darwin"`,
with a debug log for visibility.
## Test Plan
1. Run the server on macOS with faiss and another OpenMP-linked library
installed
2. Trigger a vector store operation (e.g. `POST /v1/vector_stores`) that
causes faiss to be loaded
3. Verify the server no longer crashes with `OMP: Error #15:
Initializing libomp.dylib, but found libomp.dylib already initialized`
4. Check debug logs for `Set KMP_DUPLICATE_LIB_OK=TRUE to avoid
duplicate libomp crash`
Pre-commit checks all pass:
```
uv run pre-commit run --all-files # all passed
```
Signed-off-by: Sébastien Han <seb@redhat.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent dc823bc commit 824a6dc
1 file changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
28 | 36 | | |
29 | 37 | | |
30 | 38 | | |
| |||
0 commit comments