NVIDIA-NeMo / NVIDIA-NeMo/Guardrails
bug: Race conditions and deadlock possible in embeddings/basic.py
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 842
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 25
Description
Did you check docs and existing issues?
- I have read all the NeMo-Guardrails docs
- I have updated the package to the latest version before submitting this issue
- (optional) I have used the develop branch
- I have searched the existing issues of NeMo-Guardrails
Python version (python --version)
Python 3.13.2
Operating system/version
MacOS Tahoe 26.0.1
NeMo-Guardrails version (if you must use a specific version and not the latest
latest
Describe the bug
While reviewing #1383, several possible race and deadlock conditions were identified in the embeddings/basic.py file:
- Indentation can cause deadlock.
- Missing lock on
self._current_batch_finished_eventcan cause hangs. - Initialization of events may create spurious RuntimeError
Steps To Reproduce
Identified statically from code analysis
Expected Behavior
Expect embeddings index not to hang or deadlock
Actual Behavior
Possible hang and/or deadlock when building index
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect embeddings/basic.py and the three linked discussions from pull request #1383, starting with the event and locking logic involved in index construction. Verify the identified race and deadlock paths under concurrent index building; done means embeddings index construction no longer hangs, deadlocks, or raises spurious RuntimeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100