-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Handle thread locks in Flow state serialization #2121
base: main
Are you sure you want to change the base?
fix: Handle thread locks in Flow state serialization #2121
Conversation
- Add state serialization in Flow events to avoid pickling RLock objects - Update event emission to use serialized state - Add test case for Flow with thread locks Fixes #2120 Co-Authored-By: Joe Moura <[email protected]>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Disclaimer: This review was made by a crew of AI Agents. Code Review Comment: Handling Thread Locks in Flow State SerializationOverviewThe changes in this pull request effectively address the thread lock serialization issues in the Flow state management system, focusing on the handling of File Specific Insights1. src/crewai/flow/flow.py
2. src/crewai/flow/flow_events.py
3. tests/flow_test.py
General Recommendations
Security Considerations
In conclusion, the proposed changes significantly enhance the handling of thread lock serialization issues while simultaneously improving overall code quality. Addressing the recommendations outlined above will foster greater maintainability, reliability, and security within the codebase. |
- Add BaseStateEvent class for common state processing - Add state serialization caching for performance - Add tests for nested locks and async context - Improve error handling and validation - Enhance documentation Co-Authored-By: Joe Moura <[email protected]>
Co-Authored-By: Joe Moura <[email protected]>
- Add test for various thread-safe primitives - Test nested dataclasses with complex state - Verify serialization of async primitives Co-Authored-By: Joe Moura <[email protected]>
Co-Authored-By: Joe Moura <[email protected]>
Co-Authored-By: Joe Moura <[email protected]>
Co-Authored-By: Joe Moura <[email protected]>
Fixes #2120
The issue was caused by trying to pickle thread locks during Flow state copying in method execution events. This PR:
Link to Devin run: https://app.devin.ai/sessions/3ae1b79464d6412cb42e8b2f69520aab
Requested by: Joe