1
1
openmpi/orte/test/system/orte_abort.c
Ralph Castain 629b95a2fe Afraid this has a couple of things mixed into the commit. Couldn't be helped - had missed one commit prior to running out the door on vacation.
Fix race conditions in abnormal terminations. We had done a first-cut at this in a prior commit. However, the window remained partially open due to the fact that the HNP has multiple paths leading to orte_finalize. Most of our frameworks don't care if they are finalized more than once, but one of them does, which meant we segfaulted if orte_finalize got called more than once. Besides, we really shouldn't be doing that anyway.

So we now introduce a set of atomic locks that prevent us from multiply calling abort, attempting to call orte_finalize, etc. My initial tests indicate this is working cleanly, but since it is a race condition issue, more testing will have to be done before we know for sure that this problem has been licked.

Also, some updates relevant to the tool comm library snuck in here. Since those also touched the orted code (as did the prior changes), I didn't want to attempt to separate them out - besides, they are coming in soon anyway. More on them later as that functionality approaches completion.

This commit was SVN r17843.
2008-03-17 17:58:59 +00:00

50 строки
1.1 KiB
C

/* -*- C -*-
*
* $HEADER$
*
* A program that just spins, with vpid 3 aborting - provides mechanism for testing
* abnormal program termination
*/
#include <stdio.h>
#include <unistd.h>
#include "orte/runtime/runtime.h"
#include "orte/util/proc_info.h"
#include "orte/util/name_fns.h"
#include "orte/runtime/orte_globals.h"
#include "orte/mca/errmgr/errmgr.h"
int main(int argc, char* argv[])
{
int i, rc;
double pi;
pid_t pid;
char hostname[500];
if (0 > (rc = orte_init(ORTE_NON_TOOL))) {
fprintf(stderr, "orte_abort: couldn't init orte - error code %d\n", rc);
return rc;
}
pid = getpid();
gethostname(hostname, 500);
printf("orte_abort: Name %s Host: %s Pid %ld\n", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
hostname, (long)pid);
i = 0;
while (1) {
i++;
pi = i / 3.14159256;
if (i > 10000) i = 0;
if ((ORTE_PROC_MY_NAME->vpid == 3 ||
(orte_process_info.num_procs <= 3 && ORTE_PROC_MY_NAME->vpid == 0))
&& i == 9995) {
orte_errmgr.abort(1, NULL);
}
}
return 0;
}