[
https://issues.apache.org/jira/browse/PROTON-2984?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18124777#comment-18124777
]
ASF subversion and git services commented on PROTON-2984:
---------------------------------------------------------
Commit ec5742577cb08bf8c707bcf5bb212ab4e60d1c79 in qpid-proton's branch
refs/heads/main from Andrew Stitcher
[ https://gitbox.apache.org/repos/asf?p=qpid-proton.git;h=ec5742577 ]
PROTON-2984: Close connections from the leader on proactor disconnect
on_proactor_disconnect() ran pn_connection_driver_close() directly from the
uv_walk(), which leader_lead_lh() performs with p->lock dropped. A worker
thread can own that connection's driver at the time, so the walk could touch
driver state concurrently with the worker. Set pc->disconnecting and let
leader_process_pconnection() do the close instead; that only runs for work
items the leader owns.
Deferring the close exposed a second problem with the disconnect condition.
pn_proactor_disconnect() writes p->disconnect_cond under p->lock, but the
readers run with the lock dropped: the walk itself, and now the deferred
per-connection close as well. Once the leader has cleared p->disconnect a
second pn_proactor_disconnect() is no longer suppressed, so it can
pn_condition_copy() into disconnect_cond while those readers copy out of it.
Both sides go through pn_string, so a reallocation there is a use-after-free
rather than merely a torn condition. The listener path had the same unlocked
read before this change.
Take a copy of the condition under the lock when the disconnect request is
consumed, and have both readers use that. Only the leader touches the copy, so
they need no lock.
The condition race is only reachable when an application calls
pn_proactor_disconnect() more than once, so it is latent for single-disconnect
users.
Assisted-By: Claude Opus 5 <[email protected]>
> Shutdown issues in libuv proactor
> ---------------------------------
>
> Key: PROTON-2984
> URL: https://issues.apache.org/jira/browse/PROTON-2984
> Project: Qpid Proton
> Issue Type: Bug
> Components: proton-c
> Reporter: Andrew Stitcher
> Assignee: Andrew Stitcher
> Priority: Major
>
> The libuv based proactor was observed hanging on exit when running the
> threaderciser tester.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]