You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: prevent deadlock when main thread puts on full queue
The main thread is the sole consumer of the shared queue. In 3 code
paths from _handle_item, it also produces into the queue via
ConcurrentMessageRepository.emit_message() -> queue.put(). When the
queue is full, this blocks forever — the main thread deadlocks on
its own queue.
Fix: detect when the caller is the main thread (via threading.get_ident)
and use non-blocking put(block=False). If the queue is Full, buffer the
message in a deque. Buffered messages are drained via consume_queue(),
which the main thread already calls after processing every queue item.
Worker threads are unchanged — they still use blocking put() for
normal backpressure.
Deadlock paths fixed:
1. PartitionCompleteSentinel -> _on_stream_is_done -> ensure_at_least_one_state_emitted -> emit_message -> queue.put(state)
2. PartitionGenerationCompletedSentinel -> _on_stream_is_done -> same
3. Partition -> on_partition -> emit_message(slice_log) -> queue.put(log)
Co-Authored-By: gl_anatolii.yatsuk <gl_anatolii.yatsuk@airbyte.io>
0 commit comments