Skip to content

fix: do not drop trio and twisted streaming conn - #320

Merged
gabor-boros merged 1 commit into
masterfrom
dropped-streaming-conn
Nov 16, 2026
Merged

gabor-boros merged 1 commit into
masterfrom
dropped-streaming-conn

Conversation

@gabor-boros

Copy link
Copy Markdown
Member

Reason for the change

Fixes #195

Description

This PR fixes the deadlock with Trio (and Twisted) that was caused by dropping a streaming connection.

Code examples

import trio
from rethinkdb import r

r.set_loop_type("trio")


async def print_changes(table: str) -> None:
    async with trio.open_nursery() as nursery:
        conn = await r.connect(host="localhost", port=28015, db="test", nursery=nursery)

        try:
            async with conn:
                changes = await r.table(table).changes().run(conn)
                async for change in changes:
                    print({"name": table, **change})
        except r.ReqlRuntimeError as exc:
            # Raised when the TCP connection closes during the feed.
            print(f"changefeed stopped: {exc}")


trio.run(print_changes, "orders")

Checklist

References

N/A

Signed-off-by: Gabor Boros <gabor.brs@gmail.com>
@gabor-boros
gabor-boros merged commit 9cd3f4c into master Nov 16, 2026
13 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 16, 2026
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.

Deadlock with trio, when streaming changes

1 participant