fix trace crashes from concurrent access#2616
Open
gauravyad86 wants to merge 1 commit intoconfident-ai:mainfrom
Open
fix trace crashes from concurrent access#2616gauravyad86 wants to merge 1 commit intoconfident-ai:mainfrom
gauravyad86 wants to merge 1 commit intoconfident-ai:mainfrom
Conversation
|
@gauravyad86 is attempting to deploy a commit to the Confident AI Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was the issue?
When many evaluations were running at the same time, DeepEval's tracing system was reading and updating shared in-memory data at once without proper protection.
In simple terms: two parts of the code could try to edit the same tracking data at the same moment, which could cause random crashes or incomplete trace results.
What was fixed?
A safety lock was added around shared tracing data so only one operation can change it at a time.
A few places that were directly reading shared data were updated to use safer helper methods.
One remaining method that was still reading trace data without lock protection was also fixed.
Result
Tracing is now much safer under concurrent workloads and less likely to fail with race-condition style errors.
Changes
threading.RLock(_state_lock) insideTraceManager.active_tracesactive_spanstracesObservercall paths to avoid direct unsafe shared-state access:is_trace_active(...)get_active_spans_for_trace(...)get_all_traces_dict()before iterating trace data.