On Thu, Nov 01, 2012 at 07:22:42PM -0400, George Bosilca wrote:
> 
> On Nov 1, 2012, at 19:07 , Nathan Hjelm <hje...@lanl.gov> wrote:
> 
> > I was going to address this second inconsistency with another patch but now 
> > seems like a good time to get a see if anyone has an opinion about how this 
> > should be fixed. I can think of two simple fixes:
> > 1) Since mca_base_components_open calls OBJ_CONSTRUCT should 
> > mca_base_components_close call OBJ_DESTRUCT?
> > 2) Should the caller be responsible for both the OBJ_CONSTRUCT and 
> > OBJ_DESTRUCT calls?
> 
> I'm fine either way, but I do have a slight preference for 1.
> 
> >> - it force us to have one specific output for each framework
> > 
> > This isn't the case at the moment since frameworks can call 
> > opal_output_close on any extra output streams. It would be better if 
> > frameworks have t close all open output streams using opal_output_close 
> > instead of using mca_base_components_close. If we want to change the 
> > semantics of mca_base_components_close I can redo this patch. Anyone have 
> > an opinion on this?
> 
> mca_base_components_close should not close an output stream opened by another 
> entity (or if it does the arguments should be changed to int* and it should 
> set it to -1). I think that counts as having an opinion ;)

I agree and there seems to be no other opinions on this matter. So, attached is 
a new version of the change that modifies the behavior of 
mca_base_components_close to not close the output. I made the appropriate 
changes to each framework to reflect this change.

I will RFC another patch to further modify the behavior of 
mca_base_components_close to call OBJ_DESTRUCT on the available components iff 
the list is empty. This will be a big step towards valgrind safety.



New What: Modify the behavior of mca_base_components_close to not close the 
opal_output. Any component that calls opal_output_open MUST always call 
opal_output_close.

New When: Tomorrow (Nov 6) @ 12:00PM MST

-Nathan Hjelm
HPC-3, LANL
diff --git a/ompi/mca/allocator/base/allocator_base_close.c 
b/ompi/mca/allocator/base/allocator_base_close.c
index cf9b49e..ebc0545 100644
--- a/ompi/mca/allocator/base/allocator_base_close.c
+++ b/ompi/mca/allocator/base/allocator_base_close.c
@@ -39,6 +39,10 @@ int mca_allocator_base_close(void)
   mca_base_components_close(mca_allocator_base_output,
                             &mca_allocator_base_components, NULL);

+  /* Close the framework output */
+  opal_output_close (mca_allocator_base_output);
+  mca_allocator_base_output = -1;
+
   /* All done */

   return OMPI_SUCCESS;
diff --git a/ompi/mca/bcol/base/bcol_base_close.c 
b/ompi/mca/bcol/base/bcol_base_close.c
index 3121d1e..7f8944b 100644
--- a/ompi/mca/bcol/base/bcol_base_close.c
+++ b/ompi/mca/bcol/base/bcol_base_close.c
@@ -27,6 +27,10 @@ int mca_bcol_base_close(void)
     mca_base_components_close(mca_bcol_base_output,
                               &mca_bcol_base_components_opened, NULL);

+    /* Close the framework output */
+    opal_output_close (mca_bcol_base_output);
+    mca_bcol_base_output = -1;
+
     /* All done */
     return OMPI_SUCCESS;
 }
diff --git a/ompi/mca/btl/base/btl_base_close.c 
b/ompi/mca/btl/base/btl_base_close.c
index b3632ab..022fb05 100644
--- a/ompi/mca/btl/base/btl_base_close.c
+++ b/ompi/mca/btl/base/btl_base_close.c
@@ -58,11 +58,13 @@ int mca_btl_base_close(void)

     /* Close all remaining opened components (may be one if this is a
        OMPI RTE program, or [possibly] multiple if this is ompi_info) */
-  
-    if (0 != opal_list_get_size(&mca_btl_base_components_opened)) {
-        mca_base_components_close(mca_btl_base_output, 
-                                  &mca_btl_base_components_opened, NULL);
-    }
+
+    mca_base_components_close(mca_btl_base_output,
+                              &mca_btl_base_components_opened, NULL);
+
+    /* Close the framework output */
+    opal_output_close (mca_btl_base_output);
+    mca_btl_base_output = -1;

     /* cleanup */
     if(NULL != mca_btl_base_include)
diff --git a/ompi/mca/coll/base/coll_base_close.c 
b/ompi/mca/coll/base/coll_base_close.c
index 3645634..7475d9c 100644
--- a/ompi/mca/coll/base/coll_base_close.c
+++ b/ompi/mca/coll/base/coll_base_close.c
@@ -45,6 +45,10 @@ int mca_coll_base_close(void)
         mca_coll_base_components_available_valid = false;
     }

+    /* Close the framework output */
+    opal_output_close (mca_coll_base_output);
+    mca_coll_base_output = -1;
+
     /* All done */

     return OMPI_SUCCESS;
diff --git a/ompi/mca/crcp/base/crcp_base_close.c 
b/ompi/mca/crcp/base/crcp_base_close.c
index 18c3019..c994d64 100644
--- a/ompi/mca/crcp/base/crcp_base_close.c
+++ b/ompi/mca/crcp/base/crcp_base_close.c
@@ -36,5 +36,9 @@ int ompi_crcp_base_close(void)
                               &ompi_crcp_base_components_available,
                               NULL);

+    /* Close the framework output */
+    opal_output_close (ompi_crcp_base_output);
+    ompi_crcp_base_output = -1;
+
     return OMPI_SUCCESS;
 }
diff --git a/ompi/mca/dpm/base/dpm_base_close.c 
b/ompi/mca/dpm/base/dpm_base_close.c
index f2452dc..c4f01d9 100644
--- a/ompi/mca/dpm/base/dpm_base_close.c
+++ b/ompi/mca/dpm/base/dpm_base_close.c
@@ -36,5 +36,9 @@ int ompi_dpm_base_close(void)
                               &ompi_dpm_base_components_available,
                               NULL);

+    /* Close the framework output */
+    opal_output_close (ompi_dpm_base_output);
+    ompi_dpm_base_output = -1;
+
     return OMPI_SUCCESS;
 }
diff --git a/ompi/mca/fbtl/base/fbtl_base_close.c 
b/ompi/mca/fbtl/base/fbtl_base_close.c
index c838408..5f6c328 100644
--- a/ompi/mca/fbtl/base/fbtl_base_close.c
+++ b/ompi/mca/fbtl/base/fbtl_base_close.c
@@ -47,8 +47,9 @@ int mca_fbtl_base_close(void)
         mca_fbtl_base_components_available_valid = false;
     }

-    /* Close the output stream for this framework */
+    /* Close the framework output */
     opal_output_close (mca_fbtl_base_output);
+    mca_fbtl_base_output = -1;

     /* All done */

diff --git a/ompi/mca/fcoll/base/fcoll_base_close.c 
b/ompi/mca/fcoll/base/fcoll_base_close.c
index 5f2ef3e..bf3d058 100644
--- a/ompi/mca/fcoll/base/fcoll_base_close.c
+++ b/ompi/mca/fcoll/base/fcoll_base_close.c
@@ -48,8 +48,9 @@ int mca_fcoll_base_close(void)
         mca_fcoll_base_components_available_valid = false;
     }

-    /* Close the output stream for this framework */
+    /* Close the framework output */
     opal_output_close (mca_fcoll_base_output);
+    mca_fcoll_base_output = -1;

     /* All done */

diff --git a/ompi/mca/fs/base/fs_base_close.c b/ompi/mca/fs/base/fs_base_close.c
index 3dc55bf..740e909 100644
--- a/ompi/mca/fs/base/fs_base_close.c
+++ b/ompi/mca/fs/base/fs_base_close.c
@@ -48,8 +48,9 @@ int mca_fs_base_close(void)
         mca_fs_base_components_available_valid = false;
     }

-    /* Close the output stream for this framework */
+    /* Close the framework output */
     opal_output_close (mca_fs_base_output);
+    mca_fs_base_output = -1;

     /* All done */

diff --git a/ompi/mca/io/base/io_base_close.c b/ompi/mca/io/base/io_base_close.c
index 9038663..4256b9b 100644
--- a/ompi/mca/io/base/io_base_close.c
+++ b/ompi/mca/io/base/io_base_close.c
@@ -46,6 +46,10 @@ int mca_io_base_close(void)
         mca_io_base_components_available_valid = false;
     }

+    /* Close the framework output */
+    opal_output_close (mca_io_base_output);
+    mca_io_base_output = -1;
+
     /* All done */

     return OMPI_SUCCESS;
diff --git a/ompi/mca/mpool/base/mpool_base_close.c 
b/ompi/mca/mpool/base/mpool_base_close.c
index a87d109..3c4eb77 100644
--- a/ompi/mca/mpool/base/mpool_base_close.c
+++ b/ompi/mca/mpool/base/mpool_base_close.c
@@ -64,6 +64,10 @@ int mca_mpool_base_close(void)
   mca_base_components_close(mca_mpool_base_output, 
                             &mca_mpool_base_components, NULL);

+  /* Close the framework output */
+  opal_output_close (mca_mpool_base_output);
+  mca_mpool_base_output = -1;
+
   /* deregister memory free callback */
   if( (modules_length > 0) && mca_mpool_base_used_mem_hooks && 
      0 != (OPAL_MEMORY_FREE_SUPPORT & opal_mem_hooks_support_level())) {
diff --git a/ompi/mca/mtl/base/mtl_base_component.c 
b/ompi/mca/mtl/base/mtl_base_component.c
index bdfbd07..0fbecaa 100644
--- a/ompi/mca/mtl/base/mtl_base_component.c
+++ b/ompi/mca/mtl/base/mtl_base_component.c
@@ -149,6 +149,10 @@ ompi_mtl_base_close(void)
     mca_base_components_close(ompi_mtl_base_output, 
                               &ompi_mtl_base_components_opened, NULL);

+    /* Close the framework output */
+    opal_output_close (ompi_mtl_base_output);
+    ompi_mtl_base_output = -1;
+
     /* All done */
     return OMPI_SUCCESS;
 }
diff --git a/ompi/mca/op/base/op_base_close.c b/ompi/mca/op/base/op_base_close.c
index 83755be..a590470 100644
--- a/ompi/mca/op/base/op_base_close.c
+++ b/ompi/mca/op/base/op_base_close.c
@@ -46,6 +46,10 @@ int ompi_op_base_close(void)
         ompi_op_base_components_available_valid = false;
     }

+    /* Close the framework output */
+    opal_output_close (ompi_op_base_output);
+    ompi_op_base_output = -1;
+
     /* All done */

     return OMPI_SUCCESS;
diff --git a/ompi/mca/osc/base/osc_base_close.c 
b/ompi/mca/osc/base/osc_base_close.c
index 2b38003..d497ace 100644
--- a/ompi/mca/osc/base/osc_base_close.c
+++ b/ompi/mca/osc/base/osc_base_close.c
@@ -56,5 +56,9 @@ ompi_osc_base_close(void)
     OBJ_DESTRUCT(&ompi_osc_base_open_components);
     OBJ_DESTRUCT(&ompi_osc_base_avail_components);

+    /* Close the framework output */
+    opal_output_close (ompi_osc_base_output);
+    ompi_osc_base_output = -1;
+
     return OMPI_SUCCESS;
 }
diff --git a/ompi/mca/pml/base/pml_base_close.c 
b/ompi/mca/pml/base/pml_base_close.c
index d28f853..a8cc5a4 100644
--- a/ompi/mca/pml/base/pml_base_close.c
+++ b/ompi/mca/pml/base/pml_base_close.c
@@ -75,6 +75,10 @@ int mca_pml_base_close(void)
     mca_base_components_close(mca_pml_base_output, 
                               &mca_pml_base_components_available, NULL);

+    /* Close the framework output */
+    opal_output_close (mca_pml_base_output);
+    mca_pml_base_output = -1;
+
     /* All done */

     return OMPI_SUCCESS;
diff --git a/ompi/mca/pubsub/base/pubsub_base_close.c 
b/ompi/mca/pubsub/base/pubsub_base_close.c
index fb2e569..e960bb0 100644
--- a/ompi/mca/pubsub/base/pubsub_base_close.c
+++ b/ompi/mca/pubsub/base/pubsub_base_close.c
@@ -36,5 +36,9 @@ int ompi_pubsub_base_close(void)
                               &ompi_pubsub_base_components_available,
                               NULL);

+    /* Close the framework output */
+    opal_output_close (ompi_pubsub_base_output);
+    ompi_pubsub_base_output = -1;
+
     return OMPI_SUCCESS;
 }
diff --git a/ompi/mca/rcache/base/rcache_base_close.c 
b/ompi/mca/rcache/base/rcache_base_close.c
index ed6eb2b..21d87c5 100644
--- a/ompi/mca/rcache/base/rcache_base_close.c
+++ b/ompi/mca/rcache/base/rcache_base_close.c
@@ -56,6 +56,10 @@ int mca_rcache_base_close(void)
   mca_base_components_close(mca_rcache_base_output, 
                             &mca_rcache_base_components, NULL);

+  /* Close the framework output */
+  opal_output_close (mca_rcache_base_output);
+  mca_rcache_base_output = -1;
+
   /* All done */

   return OMPI_SUCCESS;
diff --git a/ompi/mca/sbgp/base/sbgp_base_close.c 
b/ompi/mca/sbgp/base/sbgp_base_close.c
index ea54cee..99c68fc 100644
--- a/ompi/mca/sbgp/base/sbgp_base_close.c
+++ b/ompi/mca/sbgp/base/sbgp_base_close.c
@@ -29,6 +29,10 @@ int mca_sbgp_base_close(void)
     mca_base_components_close(mca_sbgp_base_output,
                               &mca_sbgp_base_components_opened, NULL);

+    /* Close the framework output */
+    opal_output_close (mca_sbgp_base_output);
+    mca_sbgp_base_output = -1;
+
     /* All done */

     return OMPI_SUCCESS;
diff --git a/ompi/mca/sharedfp/base/sharedfp_base_close.c 
b/ompi/mca/sharedfp/base/sharedfp_base_close.c
index 86cf686..3459761 100644
--- a/ompi/mca/sharedfp/base/sharedfp_base_close.c
+++ b/ompi/mca/sharedfp/base/sharedfp_base_close.c
@@ -48,8 +48,9 @@ int mca_sharedfp_base_close(void)
         mca_sharedfp_base_components_available_valid = false;
     }

-    /* Close the output stream for this framework */
+    /* Close the framework output */
     opal_output_close (mca_sharedfp_base_output);
+    mca_sharedfp_base_output = -1;

     /* All done */

diff --git a/ompi/mca/topo/base/topo_base_close.c 
b/ompi/mca/topo/base/topo_base_close.c
index 8089a58..c5a23b6 100644
--- a/ompi/mca/topo/base/topo_base_close.c
+++ b/ompi/mca/topo/base/topo_base_close.c
@@ -43,8 +43,9 @@ int mca_topo_base_close(void)
         mca_topo_base_components_available_valid = false;
     }

-    /* Close the output stream for this framework */
+    /* Close the framework output */
     opal_output_close (mca_topo_base_output);
+    mca_topo_base_output = -1;

     /*
      * All done
diff --git a/ompi/mca/vprotocol/base/vprotocol_base.c 
b/ompi/mca/vprotocol/base/vprotocol_base.c
index 95fdd71..5c3d438 100644
--- a/ompi/mca/vprotocol/base/vprotocol_base.c
+++ b/ompi/mca/vprotocol/base/vprotocol_base.c
@@ -50,5 +50,10 @@ int mca_vprotocol_base_close(void)
         free(mca_vprotocol_base_include_list);
     }
     OBJ_DESTRUCT(&mca_vprotocol_base_components_available);
+
+    /* Close the framework output */
+    opal_output_close (mca_pml_v.output);
+    mca_pml_v.output = -1;
+
     return ret;
 }
diff --git a/opal/mca/base/mca_base_components_close.c 
b/opal/mca/base/mca_base_components_close.c
index 85b968b..52d8704 100644
--- a/opal/mca/base/mca_base_components_close.c
+++ b/opal/mca/base/mca_base_components_close.c
@@ -75,15 +75,6 @@ int mca_base_components_close(int output_id,
     opal_list_append(components_available, (opal_list_item_t *) skipped_pcli);
   }

-  /*
-   * If we are not the verbose output stream, and we shouldn't skip
-   * any components, close the output stream.  If there's a skip
-   * component, this is a 'choose one' framework and we're closing the
-   * unchoosen components, but will still be using the framework.
-   */
-  if (0 != output_id && NULL == skip) {
-      opal_output_close (output_id);
-  }
   /* All done */
   return OPAL_SUCCESS;
 }
diff --git a/opal/mca/compress/base/compress_base_close.c 
b/opal/mca/compress/base/compress_base_close.c
index 691e333..c7d5054 100644
--- a/opal/mca/compress/base/compress_base_close.c
+++ b/opal/mca/compress/base/compress_base_close.c
@@ -35,6 +35,10 @@ int opal_compress_base_close(void)
     mca_base_components_close(opal_compress_base_output,
                               &opal_compress_base_components_available,
                               NULL);
+
+    /* Close the framework output */
+    opal_output_close (opal_compress_base_output);
+    opal_compress_base_output = -1;

     return OPAL_SUCCESS;
 }
diff --git a/opal/mca/crs/base/crs_base_close.c 
b/opal/mca/crs/base/crs_base_close.c
index 220827f..3a72ea0 100644
--- a/opal/mca/crs/base/crs_base_close.c
+++ b/opal/mca/crs/base/crs_base_close.c
@@ -39,6 +39,10 @@ int opal_crs_base_close(void)
     mca_base_components_close(opal_crs_base_output,
                               &opal_crs_base_components_available,
                               NULL);
+
+    /* Close the framework output */
+    opal_output_close (opal_crs_base_output);
+    opal_crs_base_output = -1;

     return OPAL_SUCCESS;
 }
diff --git a/opal/mca/event/base/event_base_close.c 
b/opal/mca/event/base/event_base_close.c
index 6ecb89f..aeed558 100644
--- a/opal/mca/event/base/event_base_close.c
+++ b/opal/mca/event/base/event_base_close.c
@@ -31,6 +31,10 @@ int opal_event_base_close(void)
     }
     OBJ_DESTRUCT(&opal_event_components);

+    /* Close the framework output */
+    opal_output_close (opal_event_base_output);
+    opal_event_base_output = -1;
+
     /* All done */
     return OPAL_SUCCESS;
 }
diff --git a/opal/mca/hwloc/base/hwloc_base_close.c 
b/opal/mca/hwloc/base/hwloc_base_close.c
index fa22c96..8abed7a 100644
--- a/opal/mca/hwloc/base/hwloc_base_close.c
+++ b/opal/mca/hwloc/base/hwloc_base_close.c
@@ -40,6 +40,10 @@ int opal_hwloc_base_close(void)
             hwloc_bitmap_free(opal_hwloc_my_cpuset);
             opal_hwloc_my_cpuset = NULL;
         }
+
+        /* Close the framework output */
+        opal_output_close (opal_hwloc_base_output);
+        opal_hwloc_base_output = -1;
     }
 #endif

diff --git a/opal/mca/if/base/if_base_components.c 
b/opal/mca/if/base/if_base_components.c
index 906c971..b29c3df 100644
--- a/opal/mca/if/base/if_base_components.c
+++ b/opal/mca/if/base/if_base_components.c
@@ -112,6 +112,10 @@ int opal_if_base_close(void)
     }
     OBJ_DESTRUCT(&opal_if_components);

+    /* Close the framework output */
+    opal_output_close (opal_if_base_output);
+    opal_if_base_output = -1;
+
     return OPAL_SUCCESS;
 }

diff --git a/opal/mca/installdirs/base/installdirs_base_components.c 
b/opal/mca/installdirs/base/installdirs_base_components.c
index 0d9d1c7..7aab79d 100644
--- a/opal/mca/installdirs/base/installdirs_base_components.c
+++ b/opal/mca/installdirs/base/installdirs_base_components.c
@@ -19,7 +19,6 @@
 #include "opal/mca/installdirs/base/base.h"
 #include "opal/mca/installdirs/base/static-components.h"

-int opal_installdirs_base_output;
 opal_install_dirs_t opal_install_dirs;
 opal_list_t opal_installdirs_components;

diff --git a/opal/mca/memchecker/base/memchecker_base_close.c 
b/opal/mca/memchecker/base/memchecker_base_close.c
index fbfa7cd..5c92ebd 100644
--- a/opal/mca/memchecker/base/memchecker_base_close.c
+++ b/opal/mca/memchecker/base/memchecker_base_close.c
@@ -20,9 +20,14 @@ int opal_memchecker_base_close(void)
 {
     /* Close all components that are still open (this should only
        happen during laminfo). */
-    mca_base_components_close(0, &opal_memchecker_base_components_opened, 
NULL);
+    mca_base_components_close(opal_memchecker_base_output,
+                              &opal_memchecker_base_components_opened, NULL);
     OBJ_DESTRUCT(&opal_memchecker_base_components_opened);

+    /* Close the framework output */
+    opal_output_close (opal_memchecker_base_output);
+    opal_memchecker_base_output = -1;
+
     /* All done */
     return OPAL_SUCCESS;
 }
diff --git a/opal/mca/pstat/base/pstat_base_close.c 
b/opal/mca/pstat/base/pstat_base_close.c
index b6a318f..da7001d 100644
--- a/opal/mca/pstat/base/pstat_base_close.c
+++ b/opal/mca/pstat/base/pstat_base_close.c
@@ -33,6 +33,10 @@ int opal_pstat_base_close(void)
     mca_base_components_close(opal_pstat_base_output,
                               &opal_pstat_base_components_opened, NULL);
     OBJ_DESTRUCT(&opal_pstat_base_components_opened);
+
+    /* Close the framework output */
+    opal_output_close (opal_pstat_base_output);
+    opal_pstat_base_output = -1;

     /* All done */

diff --git a/opal/mca/shmem/base/shmem_base_close.c 
b/opal/mca/shmem/base/shmem_base_close.c
index a4755ee..a64bbbc 100644
--- a/opal/mca/shmem/base/shmem_base_close.c
+++ b/opal/mca/shmem/base/shmem_base_close.c
@@ -48,6 +48,10 @@ opal_shmem_base_close(void)
         opal_shmem_base_components_opened_valid = false;
     }

+    /* Close the framework output */
+    opal_output_close (opal_shmem_base_output);
+    opal_shmem_base_output = -1;
+
     /* all done */
     return OPAL_SUCCESS;
 }
diff --git a/orte/mca/db/base/db_base_close.c b/orte/mca/db/base/db_base_close.c
index 719e397..40486e3 100644
--- a/orte/mca/db/base/db_base_close.c
+++ b/orte/mca/db/base/db_base_close.c
@@ -33,7 +33,11 @@ orte_db_base_close(void)
                               &orte_db_base.available_components, NULL);

     OBJ_DESTRUCT(&orte_db_base.available_components);
-    opal_output_close(orte_db_base.output);
+
+    /* Close the framework output */
+    opal_output_close (orte_db_base.output);
+    orte_db_base.output = -1;
+
     return ORTE_SUCCESS;
 }

diff --git a/orte/mca/dfs/base/dfs_base_close.c 
b/orte/mca/dfs/base/dfs_base_close.c
index 8bb1036..61e22ee 100644
--- a/orte/mca/dfs/base/dfs_base_close.c
+++ b/orte/mca/dfs/base/dfs_base_close.c
@@ -38,6 +38,10 @@ int orte_dfs_base_close(void)
                               &orte_dfs_base.components_available,
                               NULL);

+    /* Close the framework output */
+    opal_output_close (orte_dfs_base.output);
+    orte_dfs_base.output = -1;
+
     orte_dfs_base.initialized = false;

     return ORTE_SUCCESS;
diff --git a/orte/mca/errmgr/base/errmgr_base_close.c 
b/orte/mca/errmgr/base/errmgr_base_close.c
index f1a2c23..48c6ca7 100644
--- a/orte/mca/errmgr/base/errmgr_base_close.c
+++ b/orte/mca/errmgr/base/errmgr_base_close.c
@@ -51,6 +51,10 @@ int orte_errmgr_base_close(void)
                               &orte_errmgr_base_components_available,
                               NULL);

+    /* Close the framework output */
+    opal_output_close (orte_errmgr_base.output);
+    orte_errmgr_base.output = -1;
+
     orte_errmgr_base.initialized = false;

     /* always leave a default set of fn pointers */
diff --git a/orte/mca/ess/base/ess_base_close.c 
b/orte/mca/ess/base/ess_base_close.c
index 64d8ea9..872f268 100644
--- a/orte/mca/ess/base/ess_base_close.c
+++ b/orte/mca/ess/base/ess_base_close.c
@@ -42,6 +42,10 @@ orte_ess_base_close(void)
                               NULL);
     OBJ_DESTRUCT(&orte_ess_base_components_available);

+    /* Close the framework output */
+    opal_output_close (orte_ess_base_output);
+    orte_ess_base_output = -1;
+
     return ORTE_SUCCESS;
 }

diff --git a/orte/mca/filem/base/filem_base_close.c 
b/orte/mca/filem/base/filem_base_close.c
index c8f49f5..20715c2 100644
--- a/orte/mca/filem/base/filem_base_close.c
+++ b/orte/mca/filem/base/filem_base_close.c
@@ -38,6 +38,10 @@ int orte_filem_base_close(void)
     mca_base_components_close(orte_filem_base_output,
                               &orte_filem_base_components_available,
                               NULL);
+
+    /* Close the framework output */
+    opal_output_close (orte_filem_base_output);
+    orte_filem_base_output = -1;

     return ORTE_SUCCESS;
 }
diff --git a/orte/mca/grpcomm/base/grpcomm_base_close.c 
b/orte/mca/grpcomm/base/grpcomm_base_close.c
index dc453a0..9b2abba 100644
--- a/orte/mca/grpcomm/base/grpcomm_base_close.c
+++ b/orte/mca/grpcomm/base/grpcomm_base_close.c
@@ -48,6 +48,10 @@ int orte_grpcomm_base_close(void)
   }
 #endif

+  /* Close the framework output */
+  opal_output_close (orte_grpcomm_base.output);
+  orte_grpcomm_base.output = -1;
+
   /* All done */

   return ORTE_SUCCESS;
diff --git a/orte/mca/iof/base/iof_base_close.c 
b/orte/mca/iof/base/iof_base_close.c
index 4ff07f8..12c3aee 100644
--- a/orte/mca/iof/base/iof_base_close.c
+++ b/orte/mca/iof/base/iof_base_close.c
@@ -42,6 +42,10 @@ int orte_iof_base_close(void)
     }
     OBJ_DESTRUCT(&orte_iof_base.iof_components_opened);

+    /* Close the framework output */
+    opal_output_close (orte_iof_base.iof_output);
+    orte_iof_base.iof_output = -1;
+
     return ORTE_SUCCESS;
 }

diff --git a/orte/mca/odls/base/odls_base_close.c 
b/orte/mca/odls/base/odls_base_close.c
index 036496b..bf44969 100644
--- a/orte/mca/odls/base/odls_base_close.c
+++ b/orte/mca/odls/base/odls_base_close.c
@@ -53,16 +53,15 @@ int orte_odls_base_close(void)
     }
     OBJ_RELEASE(orte_local_children);

-    /* if no components are available, then punt */
-    if (!orte_odls_base.components_available) {
-        return ORTE_SUCCESS;
-    }
-    
     /* Close all available components (only one in this case)  */

     mca_base_components_close(orte_odls_globals.output, 
                               &orte_odls_base.available_components, NULL);

+    /* Close the framework output */
+    opal_output_close (orte_odls_globals.output);
+    orte_odls_globals.output = -1;
+
     /* All done */

     return ORTE_SUCCESS;
diff --git a/orte/mca/oob/base/oob_base_close.c 
b/orte/mca/oob/base/oob_base_close.c
index 3f35f29..1197870 100644
--- a/orte/mca/oob/base/oob_base_close.c
+++ b/orte/mca/oob/base/oob_base_close.c
@@ -58,6 +58,10 @@ int mca_oob_base_close(void)
   OBJ_DESTRUCT(&mca_oob_base_modules);
   OBJ_DESTRUCT(&mca_oob_base_components);

+  /* Close the framework output */
+  opal_output_close (mca_oob_base_output);
+  mca_oob_base_output = -1;
+
   /* All done */
   orte_oob_base_already_opened = false;

diff --git a/orte/mca/plm/base/plm_base_close.c 
b/orte/mca/plm/base/plm_base_close.c
index 9734a6d..f16393b 100644
--- a/orte/mca/plm/base/plm_base_close.c
+++ b/orte/mca/plm/base/plm_base_close.c
@@ -47,6 +47,10 @@ int orte_plm_base_finalize(void)
             return rc;
         }
     }
+
+    /* Close the framework output */
+    opal_output_close (orte_plm_globals.output);
+    orte_plm_globals.output = -1;

     return ORTE_SUCCESS;
 }
diff --git a/orte/mca/ras/base/ras_base_close.c 
b/orte/mca/ras/base/ras_base_close.c
index 5a981b0..f53d3f8 100644
--- a/orte/mca/ras/base/ras_base_close.c
+++ b/orte/mca/ras/base/ras_base_close.c
@@ -40,11 +40,15 @@ int orte_ras_base_finalize(void)

 int orte_ras_base_close(void)
 {
-        /* Close all remaining available components (may be one if this is a
-        Open RTE program, or [possibly] multiple if this is ompi_info) */
+    /* Close all remaining available components (may be one if this is a
+       Open RTE program, or [possibly] multiple if this is ompi_info) */
+
+    mca_base_components_close(orte_ras_base.ras_output, 
+                              &orte_ras_base.ras_opened, NULL);
+
+    /* Close the framework output */
+    opal_output_close (orte_ras_base.ras_output);
+    orte_ras_base.ras_output = -1;

-        mca_base_components_close(orte_ras_base.ras_output, 
-                                  &orte_ras_base.ras_opened, NULL);
-  
     return ORTE_SUCCESS;
 }
diff --git a/orte/mca/rmaps/base/rmaps_base_close.c 
b/orte/mca/rmaps/base/rmaps_base_close.c
index 26ffd4a..784dff0 100644
--- a/orte/mca/rmaps/base/rmaps_base_close.c
+++ b/orte/mca/rmaps/base/rmaps_base_close.c
@@ -41,5 +41,9 @@ int orte_rmaps_base_close(void)
     mca_base_components_close(orte_rmaps_base.rmaps_output, 
                               &orte_rmaps_base.available_components, NULL);

+    /* Close the framework output */
+    opal_output_close (orte_rmaps_base.rmaps_output);
+    orte_rmaps_base.rmaps_output = -1;
+
     return ORTE_SUCCESS;
 }
diff --git a/orte/mca/rml/base/rml_base_components.c 
b/orte/mca/rml/base/rml_base_components.c
index 1bf22ad..c538396 100644
--- a/orte/mca/rml/base/rml_base_components.c
+++ b/orte/mca/rml/base/rml_base_components.c
@@ -254,6 +254,10 @@ orte_rml_base_close(void)
     OBJ_DESTRUCT(&orte_rml_base_components);
     OBJ_DESTRUCT(&orte_rml_base_subscriptions);

+    /* Close the framework output */
+    opal_output_close (orte_rml_base_output);
+    orte_rml_base_output = -1;
+
     return ORTE_SUCCESS;
 }

diff --git a/orte/mca/routed/base/routed_base_components.c 
b/orte/mca/routed/base/routed_base_components.c
index c8cebfe..7e39ecc 100644
--- a/orte/mca/routed/base/routed_base_components.c
+++ b/orte/mca/routed/base/routed_base_components.c
@@ -202,6 +202,10 @@ orte_routed_base_close(void)
     OBJ_DESTRUCT(&orte_routed_base_components);
     OBJ_DESTRUCT(&orte_routed_base_lock);
     OBJ_DESTRUCT(&orte_routed_base_cond);
+
+    /* Close the framework output */
+    opal_output_close (orte_routed_base_output);
+    orte_routed_base_output = -1;

     opened   = false;
     selected = false;
diff --git a/orte/mca/sensor/base/sensor_base_close.c 
b/orte/mca/sensor/base/sensor_base_close.c
index a379279..77d3b07 100644
--- a/orte/mca/sensor/base/sensor_base_close.c
+++ b/orte/mca/sensor/base/sensor_base_close.c
@@ -39,7 +39,11 @@ int orte_sensor_base_close(void)

     mca_base_components_close(orte_sensor_base.output, 
                               &mca_sensor_base_components_available, NULL);
-    
+
+    /* Close the framework output */
+    opal_output_close (orte_sensor_base.output);
+    orte_sensor_base.output = -1;
+
     /* All done */

     return ORTE_SUCCESS;
diff --git a/orte/mca/snapc/base/snapc_base_close.c 
b/orte/mca/snapc/base/snapc_base_close.c
index d18622e..9b09897 100644
--- a/orte/mca/snapc/base/snapc_base_close.c
+++ b/orte/mca/snapc/base/snapc_base_close.c
@@ -44,6 +44,10 @@ int orte_snapc_base_close(void)
     mca_base_components_close(orte_snapc_base_output,
                               &orte_snapc_base_components_available,
                               NULL);
-    
+
+    /* Close the framework output */
+    opal_output_close (orte_snapc_base_output);
+    orte_snapc_base_output = -1;
+
     return ORTE_SUCCESS;
 }
diff --git a/orte/mca/sstore/base/sstore_base_close.c 
b/orte/mca/sstore/base/sstore_base_close.c
index 0130483..64c49d7 100644
--- a/orte/mca/sstore/base/sstore_base_close.c
+++ b/orte/mca/sstore/base/sstore_base_close.c
@@ -30,6 +30,10 @@ int orte_sstore_base_close(void)
     mca_base_components_close(orte_sstore_base_output,
                               &orte_sstore_base_components_available,
                               NULL);
-    
+
+    /* Close the framework output */
+    opal_output_close (orte_sstore_base_output);
+    orte_sstore_base_output = -1;
+
     return ORTE_SUCCESS;
 }
diff --git a/orte/mca/state/base/state_base_close.c 
b/orte/mca/state/base/state_base_close.c
index 4f7d085..448e753 100644
--- a/orte/mca/state/base/state_base_close.c
+++ b/orte/mca/state/base/state_base_close.c
@@ -38,6 +38,10 @@ int orte_state_base_close(void)
                               &orte_state_base_components_available,
                               NULL);

+    /* Close the framework output */
+    opal_output_close (orte_state_base_output);
+    orte_state_base_output = -1;
+
     orte_state_base.initialized = false;

     return ORTE_SUCCESS;

Reply via email to