Skip to content

fix: prevent deadlock in concurrent BERT auto-embeddings - #206

Merged
sanikolaev merged 3 commits into
masterfrom
fix/4915-bert-embedding-deadlock
Sep 18, 2026
Merged

sanikolaev merged 3 commits into
masterfrom
fix/4915-bert-embedding-deadlock

Conversation

@sanikolaev

@sanikolaev sanikolaev commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

Concurrent requests can enter the shared Rayon pool and block on the BERT model mutex while the active forward pass needs that pool to finish. Nested Rayon execution can therefore deadlock inference.

Serialize conversions per shared BERT model before entering the pool, while retaining parallel computation within each conversion. Add FFI regression coverage for concurrent 500-document MiniLM batches.

Related issue: manticoresoftware/manticoresearch#4915
Related PR: manticoresoftware/manticoresearch#4916

Concurrent requests can enter the shared Rayon pool and block on the
BERT model mutex while the active forward pass needs that pool to
finish. Nested Rayon execution can therefore deadlock inference.

Serialize conversions per shared BERT model before entering the pool,
while retaining parallel computation within each conversion. Add FFI
regression coverage for concurrent 500-document MiniLM batches.

Related issue: manticoresoftware/manticoresearch#4915
- Move model locking outside Rayon prediction tasks
- Pass locked state through BERT, T5, and quantized paths
- Remove per-forward mutex locking from embedding predictions

@donhardman donhardman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is a workaround, not a fix. So I implemented proper changes that should eliminate it but still subject of check on original problem. Now its clean fix that applied to all models

@sanikolaev
sanikolaev merged commit 2b83db5 into master Sep 18, 2026
10 checks passed
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