src/mca/errmgr/prted/errmgr_prted.c
/* this function only gets called when FORCED_TERMINATE
 * has been invoked, which means that there is some
 * internal failure (e.g., to pack/unpack a correct value).
 * We could just exit, but that doesn't result in any
 * meaningful error message to the user. Likewise, just
 * printing something to stdout/stderr won't necessarily
 * get back to the user. Instead, we will send an error
 * report to mpirun and give it a chance to order our
 * termination. In order to ensure we _do_ terminate,
 * we set a timer - if it fires before we receive the
 * termination command, then we will exit on our own. This
 * protects us in the case that the failure is in the
 * messaging system itself */
this function only gets called when FORCED_TERMINATE
has been invoked, which means that there is some
internal failure .
We could just exit, but that doesn't result in any
meaningful error message to the user. Likewise, just
printing something to stdout/stderr won't necessarily
get back to the user. Instead, we will send an error
report to mpirun and give it a chance to order our
termination. In order to ensure we _do_ terminate,
we set a timer - if it fires before we receive the
termination command, then we will exit on our own. This
protects us in the case that the failure is in the
messaging system itself
this function only gets called when FORCED_TERMINATE has been invoked which means that there is some internal failure . We could just exit but that doesn ' t result in any meaningful error message to the user . Likewise just printing something to stdout / stderr won ' t necessarily get back to the user . Instead we will send an error report to mpirun and give it a chance to order our termination . In order to ensure we _do_ terminate we set a timer - if it fires before we receive the termination command then we will exit on our own . This protects us in the case that the failure is in the messaging system itself
static void prted_abort(int error_code, char *fmt, ...)
{
    va_list arglist;
    char *outmsg = NULL;
    prte_plm_cmd_flag_t cmd;
    pmix_data_buffer_t *alert;
    pmix_rank_t null = PMIX_RANK_INVALID;
    prte_proc_state_t state = PRTE_PROC_STATE_CALLED_ABORT;
    prte_timer_t *timer;
    int rc;
    if (prte_abnormal_term_ordered) {
        return;
    }
    prte_abnormal_term_ordered = true;
    va_start(arglist, fmt);
    if (NULL != fmt) {
        prte_vasprintf(&outmsg, fmt, arglist);
    }
    va_end(arglist);
    prte_show_help("help-errmgr-base.txt", "simple-message", true, outmsg);
    PMIX_DATA_BUFFER_CREATE(alert);
    cmd = PRTE_PLM_UPDATE_PROC_STATE;
    rc = PMIx_Data_pack(NULL, alert, &cmd, 1, PMIX_UINT8);
    if (PMIX_SUCCESS != rc) {
        PMIX_ERROR_LOG(rc);
        PMIX_DATA_BUFFER_RELEASE(alert);
        goto cleanup;
    }
    rc = PMIx_Data_pack(NULL, alert, &PRTE_PROC_MY_NAME->nspace, 1, PMIX_PROC_NSPACE);
    if (PMIX_SUCCESS != rc) {
        PMIX_ERROR_LOG(rc);
        PMIX_DATA_BUFFER_RELEASE(alert);
        goto cleanup;
    }
    rc = PMIx_Data_pack(NULL, alert, &PRTE_PROC_MY_NAME->rank, 1, PMIX_PROC_RANK);
    if (PMIX_SUCCESS != rc) {
        PMIX_ERROR_LOG(rc);
        PMIX_DATA_BUFFER_RELEASE(alert);
        goto cleanup;
    }
    rc = PMIx_Data_pack(NULL, alert, &prte_process_info.pid, 1, PMIX_PID);
    if (PMIX_SUCCESS != rc) {
        PMIX_ERROR_LOG(rc);
        PMIX_DATA_BUFFER_RELEASE(alert);
        goto cleanup;
    }
    rc = PMIx_Data_pack(NULL, alert, &state, 1, PMIX_UINT32);
    if (PMIX_SUCCESS != rc) {
        PMIX_ERROR_LOG(rc);
        PMIX_DATA_BUFFER_RELEASE(alert);
        goto cleanup;
    }
    rc = PMIx_Data_pack(NULL, alert, &error_code, 1, PMIX_INT32);
    if (PMIX_SUCCESS != rc) {
        PMIX_ERROR_LOG(rc);
        PMIX_DATA_BUFFER_RELEASE(alert);
        goto cleanup;
    }
    rc = PMIx_Data_pack(NULL, alert, &null, 1, PMIX_PROC_RANK);
    if (PMIX_SUCCESS != rc) {
        PMIX_ERROR_LOG(rc);
        PMIX_DATA_BUFFER_RELEASE(alert);
        goto cleanup;
    }
    if (0 > (rc = prte_rml.send_buffer_nb(PRTE_PROC_MY_HNP, alert, PRTE_RML_TAG_PLM,
                                          prte_rml_send_callback, NULL))) {
        PRTE_ERROR_LOG(rc);
        PRTE_RELEASE(alert);
        prte_quit(0, 0, NULL);
        return;
    }
cleanup:
    if (NULL == (timer = PRTE_NEW(prte_timer_t))) {
        PRTE_ERROR_LOG(PRTE_ERR_OUT_OF_RESOURCE);
        return;
    }
    timer->tv.tv_sec = 5;
    timer->tv.tv_usec = 0;
    prte_event_evtimer_set(prte_event_base, timer->ev, wakeup, NULL);
    prte_event_set_priority(timer->ev, PRTE_ERROR_PRI);
    PRTE_POST_OBJECT(timer);
    prte_event_evtimer_add(timer->ev, &timer->tv);
}
static void prted_abort ( int error_code , char * fmt , ... ) { va_list arglist ; char * outmsg = NULL ; prte_plm_cmd_flag_t cmd ; pmix_data_buffer_t * alert ; pmix_rank_t null = PMIX_RANK_INVALID ; prte_proc_state_t state = PRTE_PROC_STATE_CALLED_ABORT ; prte_timer_t * timer ; int rc ; if ( prte_abnormal_term_ordered ) { return ; } prte_abnormal_term_ordered = true ; va_start ( arglist , fmt ) ; if ( NULL != fmt ) { prte_vasprintf ( & outmsg , fmt , arglist ) ; } va_end ( arglist ) ; prte_show_help ( " " , " " , true , outmsg ) ; PMIX_DATA_BUFFER_CREATE ( alert ) ; cmd = PRTE_PLM_UPDATE_PROC_STATE ; rc = PMIx_Data_pack ( NULL , alert , & cmd , 1 , PMIX_UINT8 ) ; if ( PMIX_SUCCESS != rc ) { PMIX_ERROR_LOG ( rc ) ; PMIX_DATA_BUFFER_RELEASE ( alert ) ; goto cleanup ; } rc = PMIx_Data_pack ( NULL , alert , & PRTE_PROC_MY_NAME -> nspace , 1 , PMIX_PROC_NSPACE ) ; if ( PMIX_SUCCESS != rc ) { PMIX_ERROR_LOG ( rc ) ; PMIX_DATA_BUFFER_RELEASE ( alert ) ; goto cleanup ; } rc = PMIx_Data_pack ( NULL , alert , & PRTE_PROC_MY_NAME -> rank , 1 , PMIX_PROC_RANK ) ; if ( PMIX_SUCCESS != rc ) { PMIX_ERROR_LOG ( rc ) ; PMIX_DATA_BUFFER_RELEASE ( alert ) ; goto cleanup ; } rc = PMIx_Data_pack ( NULL , alert , & prte_process_info . pid , 1 , PMIX_PID ) ; if ( PMIX_SUCCESS != rc ) { PMIX_ERROR_LOG ( rc ) ; PMIX_DATA_BUFFER_RELEASE ( alert ) ; goto cleanup ; } rc = PMIx_Data_pack ( NULL , alert , & state , 1 , PMIX_UINT32 ) ; if ( PMIX_SUCCESS != rc ) { PMIX_ERROR_LOG ( rc ) ; PMIX_DATA_BUFFER_RELEASE ( alert ) ; goto cleanup ; } rc = PMIx_Data_pack ( NULL , alert , & error_code , 1 , PMIX_INT32 ) ; if ( PMIX_SUCCESS != rc ) { PMIX_ERROR_LOG ( rc ) ; PMIX_DATA_BUFFER_RELEASE ( alert ) ; goto cleanup ; } rc = PMIx_Data_pack ( NULL , alert , & null , 1 , PMIX_PROC_RANK ) ; if ( PMIX_SUCCESS != rc ) { PMIX_ERROR_LOG ( rc ) ; PMIX_DATA_BUFFER_RELEASE ( alert ) ; goto cleanup ; } if ( 0 > ( rc = prte_rml . send_buffer_nb ( PRTE_PROC_MY_HNP , alert , PRTE_RML_TAG_PLM , prte_rml_send_callback , NULL ) ) ) { PRTE_ERROR_LOG ( rc ) ; PRTE_RELEASE ( alert ) ; prte_quit ( 0 , 0 , NULL ) ; return ; } cleanup : if ( NULL == ( timer = PRTE_NEW ( prte_timer_t ) ) ) { PRTE_ERROR_LOG ( PRTE_ERR_OUT_OF_RESOURCE ) ; return ; } timer -> tv . tv_sec = 5 ; timer -> tv . tv_usec = 0 ; prte_event_evtimer_set ( prte_event_base , timer -> ev , wakeup , NULL ) ; prte_event_set_priority ( timer -> ev , PRTE_ERROR_PRI ) ; PRTE_POST_OBJECT ( timer ) ; prte_event_evtimer_add ( timer -> ev , & timer -> tv ) ; }
this function only gets called when FORCED_TERMINATE
 has been invoked, which means that there is some
 internal failure (e.g., to pack/unpack a correct value).
this function only gets called when FORCED_TERMINATE has been invoked which means that there is some internal failure ( e . g . to pack / unpack a correct value ) .
/* only do this once */ /* set the aborting flag */ /* If there was a message, construct it */ /* use the show-help system to get the message out */ /* tell the HNP we are in distress */ /* pack update state command */ /* pack the jobid */ /* pack our vpid */ /* pack our pid */ /* pack our state */ /* pack our exit code */ /* flag that this job is complete so the receiver can know */ /* send it */ /* we can't communicate, so give up */ /* set a timer for exiting - this also gives the message a chance
     * to get out! */