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.
Summary
This PR addresses two critical issues in the Pipecat DailyTransport:
1. Original Issue: Logged Frame on Failed (Initial commit)
When frames fail to send, we now log which specific frame failed, making debugging easier.
2. New Fix: Race Condition in
DailyTransport.send_message()The transport had a race condition where
send_message()andsend_prebuilt_chat_message()would immediately reject messages if the join operation hadn't completed yet, causing production failures under load.Changes Made
Core Fixes (src/pipecat/transports/daily/transport.py)
Updated
send_message()method (lines 559-592)_joined_eventinstead of immediate rejectionUpdated
send_prebuilt_chat_message()method (lines 1050-1077)send_message()Fixed
join()error path (lines 777-783)_joined_eventeven on join failureTest Coverage (tests/test_daily_transport_service.py)
Added comprehensive unit tests:
test_send_message_waits_for_join: Verifies messages wait for join to completetest_send_message_already_joined: Confirms immediate send when already joinedtest_send_message_disconnects_during_wait: Tests error handling on disconnecttest_send_message_timeout_if_join_slow: Validates timeout behavior (10s test)All tests pass successfully.
How It Works
Before: Messages were rejected immediately if not joined
After: Messages wait for join to complete with timeout
Edge Cases Handled
Impact
Commits
fix: resolve race condition in DailyTransport.send_message()test: add tests for DailyTransport race condition fix