From 687d3b37bfddcd03b5e7cca881af688669b4f65c Mon Sep 17 00:00:00 2001 From: Bernd Machenschalk <bernd.machenschalk@ligo.org> Date: Fri, 1 Jun 2012 15:31:52 +0200 Subject: [PATCH] if libgcc_s.so.1 couldn't be loaded, calling boinc_finish() causes a SIABRT. In this case exit with exit(0). Worst that can happen is a 'too many exits' error --- .../hough/src2/EinsteinAtHome/hs_boinc_extras.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lalapps/src/pulsar/hough/src2/EinsteinAtHome/hs_boinc_extras.c b/lalapps/src/pulsar/hough/src2/EinsteinAtHome/hs_boinc_extras.c index 2925552bea..0947fcc235 100644 --- a/lalapps/src/pulsar/hough/src2/EinsteinAtHome/hs_boinc_extras.c +++ b/lalapps/src/pulsar/hough/src2/EinsteinAtHome/hs_boinc_extras.c @@ -245,6 +245,8 @@ static toplist_t* toplist; /**< the toplist we're checkpointing * static UINT4 last_count, last_total; /**< last template count, see last_rac */ static BOOLEAN do_sync = -1; /**< sync checkpoint file to disk, default: yes */ +/** record whether loading libgcc_s.so.1 succeeded */ +static int libgcc_s_loaded = 0; /*^* LOCAL FUNCTION PROTOTYPES *^*/ @@ -428,6 +430,16 @@ static void sighandler(int sig) return; } /* termination signals */ + /* A SIABRT most likely came from a failure to load libgcc_s.so.1, + which is required for boinc_finish() (calling pthread_exit() calling + pthread_cancel()) to work properly. In this case take the "emergency + exit" with exit status 0 - the worst that can happen is that + the tasks ends up with "too many exits" error. */ + if ( ( libgcc_s_loaded == -1 ) && ( sig == SIGABRT ) ) { + fputs("Program received SIGABRT probably because libgcc_s.so.1 wasn't loaded - trying exit(0)\n", stderr); + exit(0); + } + #ifdef __GLIBC__ #ifdef __X86__ /* in case of a floating-point exception write out the FPU status */ @@ -1110,9 +1122,10 @@ static void worker (void) { void *lib_handle = dlopen("libgcc_s.so.1", RTLD_LAZY); if(lib_handle) { LogPrintf (LOG_DEBUG, "Successfully loaded libgcc_s.so.1\n"); - /* dlclose(lib_handle); */ + libgcc_s_loaded = 1; } else { LogPrintf (LOG_DEBUG, "Couldn't load libgcc_s.so.1: %s\n", dlerror()); + libgcc_s_loaded = -1; } } #endif -- GitLab