Ensure we cleanup DFS worker threads during finalize to avoid segfaulting in MCA param cleanup
authorrhc
Tue Dec 25 21:17:35 2012 +0000 (5 months ago)
changeset 2110755507abe10ef
parent 21106 7fb24bb4f508
child 21108 290e6e2f8fdc
Ensure we cleanup DFS worker threads during finalize to avoid segfaulting in MCA param cleanup
orte/mca/dfs/orted/dfs_orted.c
orte/mca/ess/base/ess_base_std_orted.c
     1.1 --- a/orte/mca/dfs/orted/dfs_orted.c	Tue Dec 25 19:33:20 2012 +0000
     1.2 +++ b/orte/mca/dfs/orted/dfs_orted.c	Tue Dec 25 21:17:35 2012 +0000
     1.3 @@ -97,20 +97,12 @@
     1.4      dfs_purge_file_maps
     1.5  };
     1.6  
     1.7 -static void finalize_thread(int fd, short args, void *cbdata)
     1.8 -{
     1.9 -    /* nothing to do here - we just need it to
    1.10 -     * kick us out of the event_loop
    1.11 -     */
    1.12 -}
    1.13 -
    1.14  static void* worker_thread_engine(opal_object_t *obj);
    1.15  
    1.16  typedef struct {
    1.17      opal_object_t super;
    1.18      int idx;
    1.19      opal_event_base_t *event_base;
    1.20 -    opal_event_t fin_ev;
    1.21      bool active;
    1.22      opal_thread_t thread;
    1.23  } worker_thread_t;
    1.24 @@ -118,8 +110,6 @@
    1.25  {
    1.26      /* create an event base for this thread */
    1.27      ptr->event_base = opal_event_base_create();
    1.28 -    /* setup an event to finalize it */
    1.29 -    opal_event_set(ptr->event_base, &ptr->fin_ev, -1, OPAL_EV_WRITE, finalize_thread, NULL);
    1.30      /* construct the thread object */
    1.31      OBJ_CONSTRUCT(&ptr->thread, opal_thread_t);
    1.32      /* fork off a thread to progress it */
    1.33 @@ -132,8 +122,8 @@
    1.34  {
    1.35      /* stop the thread */
    1.36      ptr->active = false;
    1.37 -    /* trigger the finalize event */
    1.38 -    opal_event_active(&ptr->fin_ev, OPAL_EV_WRITE, 1);
    1.39 +    /* break the loop */
    1.40 +    opal_event_base_loopbreak(ptr->event_base);
    1.41      /* wait for thread to exit */
    1.42      opal_thread_join(&ptr->thread, NULL);
    1.43      OBJ_DESTRUCT(&ptr->thread);
     2.1 --- a/orte/mca/ess/base/ess_base_std_orted.c	Tue Dec 25 19:33:20 2012 +0000
     2.2 +++ b/orte/mca/ess/base/ess_base_std_orted.c	Tue Dec 25 21:17:35 2012 +0000
     2.3 @@ -628,6 +628,9 @@
     2.4          unlink(log_path);
     2.5      }
     2.6      
     2.7 +    /* close the dfs so its threads can exit */
     2.8 +    orte_dfs_base_close();
     2.9 +
    2.10      /* make sure our local procs are dead */
    2.11      orte_odls.kill_local_procs(NULL);
    2.12