Skip to content

Commit 1c4b735

Browse files
committed
oob/tcp: cleanup peers before event bases
This commit fixes an error in teardown where the event bases are town down before the peer structures are released. This causes us to call event_del on an invalid event base. At best this makes valgrind complain and at worst this causes aborts or segvs. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent ead453e commit 1c4b735

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

orte/mca/oob/tcp/oob_tcp_component.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights
13+
* Copyright (c) 2006-2017 Los Alamos National Security, LLC. All rights
1414
* reserved.
1515
* Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
1616
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
@@ -182,22 +182,9 @@ static int tcp_component_open(void)
182182
*/
183183
static int tcp_component_close(void)
184184
{
185-
mca_oob_tcp_peer_t *peer;
186-
uint64_t ui64;
187-
188185
/* cleanup listen event list */
189186
OBJ_DESTRUCT(&mca_oob_tcp_component.listeners);
190187

191-
/* cleanup all peers */
192-
OPAL_HASH_TABLE_FOREACH(ui64, uint64, peer, &mca_oob_tcp_component.peers) {
193-
opal_output_verbose(2, orte_oob_base_framework.framework_output,
194-
"%s RELEASING PEER OBJ %s",
195-
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
196-
(NULL == peer) ? "NULL" : ORTE_NAME_PRINT(&peer->name));
197-
if (NULL != peer) {
198-
OBJ_RELEASE(peer);
199-
}
200-
}
201188
OBJ_DESTRUCT(&mca_oob_tcp_component.peers);
202189

203190
if (NULL != mca_oob_tcp_component.ipv4conns) {
@@ -722,13 +709,26 @@ static void cleanup(int sd, short args, void *cbdata)
722709

723710
static void component_shutdown(void)
724711
{
712+
mca_oob_tcp_peer_t *peer;
713+
uint64_t ui64;
725714
int i = 0;
726715
bool active;
727716

728717
opal_output_verbose(2, orte_oob_base_framework.framework_output,
729718
"%s TCP SHUTDOWN",
730719
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
731720

721+
/* cleanup all peers */
722+
OPAL_HASH_TABLE_FOREACH(ui64, uint64, peer, &mca_oob_tcp_component.peers) {
723+
opal_output_verbose(2, orte_oob_base_framework.framework_output,
724+
"%s RELEASING PEER OBJ %s",
725+
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
726+
(NULL == peer) ? "NULL" : ORTE_NAME_PRINT(&peer->name));
727+
if (NULL != peer) {
728+
OBJ_RELEASE(peer);
729+
}
730+
}
731+
732732
if (0 < orte_oob_base.num_threads) {
733733
for (i=0; i < orte_oob_base.num_threads; i++) {
734734
opal_progress_thread_finalize(mca_oob_tcp_component.ev_threads[i]);

0 commit comments

Comments
 (0)