Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

Fix segmentation fault in concurrent execution (issue #2632)

Description

This PR fixes a segmentation fault that occurs when using CrewAI with concurrent execution through either threading (ThreadPoolExecutor) or asyncio with Semaphores.

Changes

  • Added thread-local storage for locks in the CacheHandler class to avoid pickling issues
  • Made the Telemetry class thread-safe with thread-local locks
  • Fixed initialization of the CacheHandler in Crew class
  • Added comprehensive tests for concurrent execution

Testing

  • Added tests that specifically verify concurrent execution works with both threading and asyncio approaches
  • The tests use mocked LLMs to ensure fast and reliable testing

Related Issues

Fixes #2632

Link to Devin run: https://app.devin.ai/sessions/83f288bc1664409c9aebb45d9f6bc1aa
For: Joe Moura (joao@crewai.com)

Co-Authored-By: Joe Moura <joao@crewai.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration
Copy link
Contributor Author

Closing due to inactivity for more than 7 days.

@locobuzz-rohan
Copy link

Hi, I think we are also experiencing similar issue with crewai running in Async version. We are using asynckickoff method of crewai. Please see if it can be fixed as soon as possible. Also if there is any crewai version that does not have this issue?

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.

[BUG] Segmentation fault (core dumped)

2 participants