@@ -401,7 +401,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided,
401401 volatile bool active ;
402402 bool background_fence = false;
403403 pmix_info_t info [2 ];
404- pmix_status_t codes [1 ] = { PMIX_ERR_PROC_ABORTED };
404+ pmix_status_t codes [2 ] = { PMIX_ERR_PROC_ABORTED , PMIX_ERR_LOST_CONNECTION };
405405 pmix_status_t rc ;
406406 OMPI_TIMING_INIT (64 );
407407 opal_pmix_lock_t mylock ;
@@ -576,12 +576,27 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided,
576576 }
577577
578578 /* Register the default errhandler callback */
579+ /* give it a name so we can distinguish it */
580+ PMIX_INFO_LOAD (& info [0 ], PMIX_EVENT_HDLR_NAME , "MPI-Default" , PMIX_STRING );
581+ OPAL_PMIX_CONSTRUCT_LOCK (& mylock );
582+ PMIx_Register_event_handler (NULL , 0 , info , 1 , ompi_errhandler_callback , evhandler_reg_callbk , (void * )& mylock );
583+ OPAL_PMIX_WAIT_THREAD (& mylock );
584+ rc = mylock .status ;
585+ OPAL_PMIX_DESTRUCT_LOCK (& mylock );
586+ PMIX_INFO_DESTRUCT (& info [0 ]);
587+ if (PMIX_SUCCESS != rc ) {
588+ error = "Error handler registration" ;
589+ ret = opal_pmix_convert_status (rc );
590+ goto error ;
591+ }
592+
593+ /* Register the ULFM errhandler callback */
579594 /* we want to go first */
580595 PMIX_INFO_LOAD (& info [0 ], PMIX_EVENT_HDLR_PREPEND , NULL , PMIX_BOOL );
581596 /* give it a name so we can distinguish it */
582- PMIX_INFO_LOAD (& info [1 ], PMIX_EVENT_HDLR_NAME , "MPI -Default" , PMIX_STRING );
597+ PMIX_INFO_LOAD (& info [1 ], PMIX_EVENT_HDLR_NAME , "ULFM -Default" , PMIX_STRING );
583598 OPAL_PMIX_CONSTRUCT_LOCK (& mylock );
584- PMIx_Register_event_handler (codes , 1 , info , 2 , ompi_errhandler_callback , evhandler_reg_callbk , (void * )& mylock );
599+ PMIx_Register_event_handler (codes , 2 , info , 2 , ompi_errhandler_callback , evhandler_reg_callbk , (void * )& mylock );
585600 OPAL_PMIX_WAIT_THREAD (& mylock );
586601 rc = mylock .status ;
587602 OPAL_PMIX_DESTRUCT_LOCK (& mylock );
0 commit comments