qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject qpid-proton git commit: PROTON-1766: [c-epoll] Fix initialization order race
Date Tue, 27 Feb 2018 20:51:47 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master 05a702f9f -> 0774a4caa


PROTON-1766: [c-epoll] Fix initialization order race

Set the pn_connection_t backpointer *after* the pconnection has been set up.

Otherwise there is a race with pn_connection_wake() on connections that are
re-used after pn_proactor_release_connection()


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/0774a4ca
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/0774a4ca
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/0774a4ca

Branch: refs/heads/master
Commit: 0774a4caa637481c438d40b5bbc815ff8fcbba25
Parents: 05a702f
Author: Alan Conway <aconway@redhat.com>
Authored: Tue Feb 27 15:32:30 2018 -0500
Committer: Alan Conway <aconway@redhat.com>
Committed: Tue Feb 27 15:32:30 2018 -0500

----------------------------------------------------------------------
 proton-c/src/proactor/epoll.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0774a4ca/proton-c/src/proactor/epoll.c
----------------------------------------------------------------------
diff --git a/proton-c/src/proactor/epoll.c b/proton-c/src/proactor/epoll.c
index efe2a82..483173a 100644
--- a/proton-c/src/proactor/epoll.c
+++ b/proton-c/src/proactor/epoll.c
@@ -773,8 +773,6 @@ static const char *pconnection_setup(pconnection_t *pc, pn_proactor_t
*p, pn_con
     return "pn_connection_driver_init failure";
   }
 
-  set_pconnection(pc->driver.connection, pc);
-
   pcontext_init(&pc->context, PCONNECTION, p, pc);
   psocket_init(&pc->psocket, p, NULL, addr);
   pc->new_events = 0;
@@ -802,6 +800,12 @@ static const char *pconnection_setup(pconnection_t *pc, pn_proactor_t
*p, pn_con
   }
   pmutex_init(&pc->rearm_mutex);
 
+  /* Set the pconnection_t backpointer last.
+     Connections that were released by pn_proactor_release_connection() must not reveal themselves
+     to be re-associated with a proactor till setup is complete.
+   */
+  set_pconnection(pc->driver.connection, pc);
+
   return NULL;
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message