From a0ae63f19e4841ef3d116ba1bf7ed73d2a67ebf5 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 28 Jul 2008 16:40:11 +0000 Subject: [PATCH] Ensure we call close_port after comm_spawn[_multiple]. Cleanout the port name in close_port This commit was SVN r19068. --- ompi/mca/dpm/orte/dpm_orte.c | 2 ++ ompi/mpi/c/comm_spawn.c | 7 +++++-- ompi/mpi/c/comm_spawn_multiple.c | 8 ++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ompi/mca/dpm/orte/dpm_orte.c b/ompi/mca/dpm/orte/dpm_orte.c index 18cda07be2..2b68ec976f 100644 --- a/ompi/mca/dpm/orte/dpm_orte.c +++ b/ompi/mca/dpm/orte/dpm_orte.c @@ -918,6 +918,8 @@ cleanup: static int close_port(char *port_name) { + /* the port name is a pointer to an array - DO NOT FREE IT! */ + memset(port_name, 0, MPI_MAX_PORT_NAME); return OMPI_SUCCESS; } diff --git a/ompi/mpi/c/comm_spawn.c b/ompi/mpi/c/comm_spawn.c index d9289b6997..7bc3ef2920 100644 --- a/ompi/mpi/c/comm_spawn.c +++ b/ompi/mpi/c/comm_spawn.c @@ -120,8 +120,11 @@ int MPI_Comm_spawn(char *command, char **argv, int maxprocs, MPI_Info info, error: OPAL_CR_EXIT_LIBRARY(); - /* close the port again. Nothing has to be done for that at the moment.*/ - + /* close the port */ + if (rank == root && !non_mpi) { + ompi_dpm.close_port(port_name); + } + /* set error codes */ if (MPI_ERRCODES_IGNORE != array_of_errcodes) { for ( i=0; i < maxprocs; i++ ) { diff --git a/ompi/mpi/c/comm_spawn_multiple.c b/ompi/mpi/c/comm_spawn_multiple.c index 479a3ea5b2..1332ec65dd 100644 --- a/ompi/mpi/c/comm_spawn_multiple.c +++ b/ompi/mpi/c/comm_spawn_multiple.c @@ -162,8 +162,12 @@ int MPI_Comm_spawn_multiple(int count, char **array_of_commands, char ***array_o error: OPAL_CR_EXIT_LIBRARY(); - /* close the port again. Nothing has to be done for that at the moment.*/ - + + /* close the port */ + if (rank == root && !non_mpi) { + ompi_dpm.close_port(port_name); + } + /* set array of errorcodes */ if (MPI_ERRCODES_IGNORE != array_of_errcodes) { for ( i=0; i < newcomp->c_remote_group->grp_proc_count; i++ ) {