Commit c44f2c3d authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

refs #5671 get cores on alarm failure


git-svn-id: file:///svn/toku/tokudb@50277 c7de825b-a66e-492c-adef-691d508d4ae1
parent 55894dac
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <signal.h>
#include <locale.h> #include <locale.h>
#include <unistd.h> #include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
...@@ -1487,6 +1488,11 @@ static void *test_time(void *arg) { ...@@ -1487,6 +1488,11 @@ static void *test_time(void *arg) {
return arg; return arg;
} }
static void crashing_alarm_handler(int sig) {
assert(sig == SIGALRM);
toku_hard_crash_on_purpose();
}
static int run_workers( static int run_workers(
struct arg *thread_args, struct arg *thread_args,
int num_threads, int num_threads,
...@@ -1534,6 +1540,8 @@ static int run_workers( ...@@ -1534,6 +1540,8 @@ static int run_workers(
void *ret; void *ret;
r = toku_pthread_join(time_tid, &ret); assert_zero(r); r = toku_pthread_join(time_tid, &ret); assert_zero(r);
if (verbose) printf("%lu joined\n", (unsigned long) time_tid); if (verbose) printf("%lu joined\n", (unsigned long) time_tid);
sighandler_t old_alarm = signal(SIGALRM, crashing_alarm_handler);
assert(old_alarm != SIG_ERR);
// Set an alarm that will kill us if it takes too long to join all the // Set an alarm that will kill us if it takes too long to join all the
// threads (i.e. there is some runaway thread). // threads (i.e. there is some runaway thread).
unsigned int remaining = alarm(cli_args->join_timeout); unsigned int remaining = alarm(cli_args->join_timeout);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment