Skip to content

fix: assign receive-loop attributes before spawning recv task#102

Open
SAY-5 wants to merge 1 commit into
agentclientprotocol:mainfrom
SAY-5:fix-connection-init-order
Open

fix: assign receive-loop attributes before spawning recv task#102
SAY-5 wants to merge 1 commit into
agentclientprotocol:mainfrom
SAY-5:fix-connection-init-order

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 21, 2026

Fixes #97. Connection.__init__ spawns the receive task before assigning self._receive_timeout, so under asyncio.eager_task_factory the loop runs synchronously through asyncio.wait_for(self._reader.readline(), timeout=self._receive_timeout) and raises AttributeError, tearing the connection down before __init__ returns. Moved _observers and _receive_timeout above the _tasks.create(_receive_loop(), ...) call and added a regression test that installs the eager task factory.

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.

bug: Connection.__init__ ordering bug: _receive_timeout set after recv task is spawned (breaks under asyncio.eager_task_factory)

1 participant