More bug fixes. The finalize functions in the oob were not being called,
which lead to some race conditions. There are still cases where the tcp oob will segfault. This commit was SVN r1928.
Этот коммит содержится в:
родитель
a35a6ff778
Коммит
c592935f89
@ -10,15 +10,33 @@
|
||||
#include "mca/mca.h"
|
||||
#include "mca/base/base.h"
|
||||
#include "mca/oob/oob.h"
|
||||
#include "mca/oob/base/base.h"
|
||||
|
||||
|
||||
int mca_oob_base_close(void)
|
||||
{
|
||||
ompi_list_item_t* item;
|
||||
/* Finalize all the ptl components and free their list items */
|
||||
|
||||
for (item = ompi_list_remove_first(&mca_oob_base_components);
|
||||
NULL != item;
|
||||
item = ompi_list_remove_first(&mca_oob_base_components)) {
|
||||
mca_base_component_list_item_t* component = (mca_base_component_list_item_t *) item;
|
||||
|
||||
/* Blatently ignore the return code (what would we do to recover,
|
||||
anyway? This component is going away, so errors don't matter
|
||||
anymore) */
|
||||
|
||||
((mca_oob_base_component_t*)component->cli_component)->oob_finalize();
|
||||
free(component);
|
||||
}
|
||||
|
||||
/* Close all remaining available modules (may be one if this is a
|
||||
OMPI RTE program, or [possibly] multiple if this is ompi_info) */
|
||||
|
||||
mca_base_components_close(mca_oob_base_output, &mca_oob_base_components,
|
||||
NULL);
|
||||
|
||||
OBJ_DESTRUCT(&mca_oob_base_modules);
|
||||
OBJ_DESTRUCT(&mca_oob_base_components);
|
||||
|
||||
|
@ -245,7 +245,6 @@ static void mca_oob_tcp_recv_handler(int sd, short flags, void* user)
|
||||
close(sd);
|
||||
return;
|
||||
}
|
||||
|
||||
/* is the peer instance willing to accept this connection */
|
||||
if(mca_oob_tcp_peer_accept(peer, sd) == false) {
|
||||
ompi_output(0, "mca_oob_tcp_recv_handler: peer instance not willing to accept connection.");
|
||||
@ -306,22 +305,28 @@ mca_oob_t* mca_oob_tcp_init(bool *allow_multi_user_threads, bool *have_hidden_th
|
||||
*/
|
||||
int mca_oob_tcp_finalize(void)
|
||||
{
|
||||
/* TODO: need to cleanup all peers - check for pending send/recvs. etc. */
|
||||
int optval;
|
||||
mca_oob_tcp_peer_t * peer;
|
||||
while(NULL != (peer = (mca_oob_tcp_peer_t *)
|
||||
ompi_list_remove_first(&mca_oob_tcp_component.tcp_peer_list))) {
|
||||
OMPI_THREAD_LOCK(&peer->peer_lock);
|
||||
mca_oob_tcp_peer_close(peer);
|
||||
OMPI_THREAD_UNLOCK(&peer->peer_lock);
|
||||
OBJ_DESTRUCT(peer);
|
||||
}
|
||||
if (mca_oob_tcp_component.tcp_listen_sd >= 0) {
|
||||
optval = 1;
|
||||
if(setsockopt(mca_oob_tcp_component.tcp_listen_sd, SOL_SOCKET,
|
||||
SO_REUSEADDR, &optval, sizeof(optval)) < 0) {
|
||||
ompi_output(0,
|
||||
"mca_oob_tcp_finalize: setsockopt(SO_REUSEADDR) failed with errno=%d\n",
|
||||
errno);
|
||||
}
|
||||
ompi_event_del(&mca_oob_tcp_component.tcp_recv_event);
|
||||
if(0 != close(mca_oob_tcp_component.tcp_listen_sd)) {
|
||||
ompi_output(0, "mca_oob_tcp_finalize: error closing listen socket. errno=%d", errno);
|
||||
}
|
||||
}
|
||||
/* TODO: need to cleanup all peers - check for pending send/recvs. etc. */
|
||||
while(NULL != (peer = (mca_oob_tcp_peer_t *)
|
||||
ompi_list_remove_first(&mca_oob_tcp_component.tcp_peer_list))) {
|
||||
OBJ_DESTRUCT(peer);
|
||||
}
|
||||
ompi_event_fini();
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
|
||||
include $(top_srcdir)/config/Makefile.options
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/test/support -DOMPI_ENABLE_DEBUG_OVERRIDE=1
|
||||
AM_CPPFLAGS = -g -I$(top_srcdir)/test/support -DOMPI_ENABLE_DEBUG_OVERRIDE=1
|
||||
|
||||
noinst_PROGRAMS = \
|
||||
oob_test \
|
||||
|
@ -18,7 +18,7 @@
|
||||
#define MSG_TYPE_1 1
|
||||
#define MSG_TYPE_2 2
|
||||
#define NUM_TESTS 8
|
||||
#define NUM_TIMES 5
|
||||
#define NUM_TIMES 1
|
||||
|
||||
int i;
|
||||
bool testdone[NUM_TESTS * NUM_TIMES];
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user