Skip to content

Terminate rejected target_session_attrs candidates before returning - #1380

Merged
elprans merged 1 commit into
masterfrom
session-attrs-terminate
Oct 2, 2026
Merged

elprans merged 1 commit into
masterfrom
session-attrs-terminate

Conversation

@elprans

@elprans elprans commented Oct 2, 2026

Copy link
Copy Markdown
Member

With target_session_attrs, connect() opens candidate connections in
turn until one has the requested attribute. Rejected candidates used to
be closed in a detached task. That task could outlive the caller's event
loop, producing "Event loop is closed" errors and pending-task warnings,
and leaving the connections open.

Now every candidate that is not returned is terminated before
connect() exits, whether the attribute check matched, did not match,
raised, or was cancelled.

With `target_session_attrs`, `connect()` opens candidate connections in
turn until one has the requested attribute. Rejected candidates used to
be closed in a detached task. That task could outlive the caller's event
loop, producing "Event loop is closed" errors and pending-task warnings,
and leaving the connections open.

Now every candidate that is not returned is terminated before
`connect()` exits, whether the attribute check matched, did not match,
raised, or was cancelled.
@elprans
elprans merged commit 46dda91 into master Oct 2, 2026
66 checks passed
@elprans
elprans deleted the session-attrs-terminate branch October 2, 2026 20:19
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.

1 participant