summaryrefslogtreecommitdiff
path: root/innobase/srv/srv0srv.c
diff options
context:
space:
mode:
authorunknown <marko@hundin.mysql.fi>2004-10-07 15:58:47 +0300
committerunknown <marko@hundin.mysql.fi>2004-10-07 15:58:47 +0300
commit7949ffc86aa4789a8c3fe886721db974d9914c79 (patch)
tree6c6c71ac06543487ce1be974ef3195580c76cb53 /innobase/srv/srv0srv.c
parent1601646a8846c5246d803411fc349237bfdd998b (diff)
downloadmariadb-git-7949ffc86aa4789a8c3fe886721db974d9914c79.tar.gz
InnoDB: tolerate system clock glitches a little better
in the error monitor thread. (Bug #5898) innobase/include/sync0arr.h: sync_array_print_long_waits(): return error status innobase/srv/srv0srv.c: srv_error_monitor_thread(): Keep track on successive fatal timeouts, and crash the server only if the timeouts have been exceeded for several times in succession. innobase/sync/sync0arr.c: sync_array_print_long_waits(): return error status
Diffstat (limited to 'innobase/srv/srv0srv.c')
-rw-r--r--innobase/srv/srv0srv.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index d799ada1e20..0643ab96c1d 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -1754,7 +1754,8 @@ srv_error_monitor_thread(
/* in: a dummy parameter required by
os_thread_create */
{
- ulint cnt = 0;
+ /* number of successive fatal timeouts observed */
+ ulint fatal_cnt = 0;
#ifdef UNIV_DEBUG_THREAD_CREATION
fprintf(stderr, "Error monitor thread starts, id %lu\n",
@@ -1763,8 +1764,6 @@ srv_error_monitor_thread(
loop:
srv_error_monitor_active = TRUE;
- cnt++;
-
os_thread_sleep(2000000);
if (difftime(time(NULL), srv_last_monitor_time) > 60) {
@@ -1774,7 +1773,20 @@ loop:
srv_refresh_innodb_monitor_stats();
}
- sync_array_print_long_waits();
+ if (sync_array_print_long_waits()) {
+ fatal_cnt++;
+ if (fatal_cnt > 5) {
+
+ fprintf(stderr,
+"InnoDB: Error: semaphore wait has lasted > %lu seconds\n"
+"InnoDB: We intentionally crash the server, because it appears to be hung.\n",
+ srv_fatal_semaphore_wait_threshold);
+
+ ut_error;
+ }
+ } else {
+ fatal_cnt = 0;
+ }
/* Flush stderr so that a database user gets the output
to possible MySQL error file */