Skip to content

Conversation

@ihower
Copy link
Contributor

@ihower ihower commented Nov 27, 2025

Resolved: 2130

This PR fixes a bug where Runner.run_streamed() could hang forever if session.add_items() raises an exception during streaming.

Root cause

When an exception happens in the outer error handling of _start_streaming, the completion sentinel is not sent. Because of that, the event queue never receives QueueCompleteSentinel, and stream_events() waits forever.

Solution

This PR marks the stream as complete in the outer error handling when is_complete is still False, so the stream will not hang and the exception can be raised to the caller.

A regression test is added to make sure exceptions are properly raised instead of causing the stream to hang.

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.

Streaming hangs indefinitely when session.add_items() raises an exception

1 participant