mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 08:38:30 +00:00
Fix Python 3.10 segmentation fault in FilteredStream threading
- Remove race condition in FilteredStream.write() method - Remove class-level _lock = None that caused threading issues - Ensures proper lock initialization in __init__ only Fixes Python 3.10 CI test failures with exit code 139 Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
@@ -56,16 +56,11 @@ load_dotenv()
|
|||||||
|
|
||||||
|
|
||||||
class FilteredStream(io.TextIOBase):
|
class FilteredStream(io.TextIOBase):
|
||||||
_lock = None
|
|
||||||
|
|
||||||
def __init__(self, original_stream: TextIO):
|
def __init__(self, original_stream: TextIO):
|
||||||
self._original_stream = original_stream
|
self._original_stream = original_stream
|
||||||
self._lock = threading.Lock()
|
self._lock = threading.Lock()
|
||||||
|
|
||||||
def write(self, s: str) -> int:
|
def write(self, s: str) -> int:
|
||||||
if not self._lock:
|
|
||||||
self._lock = threading.Lock()
|
|
||||||
|
|
||||||
with self._lock:
|
with self._lock:
|
||||||
# Filter out extraneous messages from LiteLLM
|
# Filter out extraneous messages from LiteLLM
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user