diff options
author | bar@mysql.com <> | 2005-03-05 18:20:35 +0400 |
---|---|---|
committer | bar@mysql.com <> | 2005-03-05 18:20:35 +0400 |
commit | d50d2131628e625a6cc11e1b8501a4b057e07abe (patch) | |
tree | 7975cf16834c464fd8132f9adfa4cf79235cae5c /innobase | |
parent | df2b38913fa321e5074b378ee99e5c435aff2c54 (diff) | |
parent | 6d7862aeafa2376910c28dc27fc998b9675b5d16 (diff) | |
download | mariadb-git-d50d2131628e625a6cc11e1b8501a4b057e07abe.tar.gz |
Merge
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/trx/trx0trx.c | 17 | ||||
-rw-r--r-- | innobase/ut/ut0mem.c | 34 |
2 files changed, 41 insertions, 10 deletions
diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c index 344fe280711..dd4da33abb5 100644 --- a/innobase/trx/trx0trx.c +++ b/innobase/trx/trx0trx.c @@ -262,6 +262,20 @@ trx_free( putc('\n', stderr); } + if (trx->n_mysql_tables_in_use != 0 + || trx->mysql_n_tables_locked != 0) { + + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: Error: MySQL is freeing a thd\n" +"InnoDB: though trx->n_mysql_tables_in_use is %lu\n" +"InnoDB: and trx->mysql_n_tables_locked is %lu.\n", + (ulong)trx->n_mysql_tables_in_use, + (ulong)trx->mysql_n_tables_locked); + + trx_print(stderr, trx); + } + ut_a(trx->magic_n == TRX_MAGIC_N); trx->magic_n = 11112222; @@ -272,9 +286,6 @@ trx_free( ut_a(trx->insert_undo == NULL); ut_a(trx->update_undo == NULL); - - ut_a(trx->n_mysql_tables_in_use == 0); - ut_a(trx->mysql_n_tables_locked == 0); if (trx->undo_no_arr) { trx_undo_arr_free(trx->undo_no_arr); diff --git a/innobase/ut/ut0mem.c b/innobase/ut/ut0mem.c index 9e026ed0011..69d4f586ff7 100644 --- a/innobase/ut/ut0mem.c +++ b/innobase/ut/ut0mem.c @@ -14,6 +14,7 @@ Created 5/11/1994 Heikki Tuuri #include "mem0mem.h" #include "os0sync.h" +#include "os0thread.h" /* This struct is placed first in every allocated memory block */ typedef struct ut_mem_block_struct ut_mem_block_t; @@ -66,6 +67,7 @@ ut_malloc_low( ibool assert_on_error) /* in: if TRUE, we crash mysqld if the memory cannot be allocated */ { + ulint retry_count = 0; void* ret; ut_ad((sizeof(ut_mem_block_t) % 8) == 0); /* check alignment ok */ @@ -73,24 +75,26 @@ ut_malloc_low( if (!ut_mem_block_list_inited) { ut_mem_block_list_init(); } - +retry: os_fast_mutex_lock(&ut_list_mutex); ret = malloc(n + sizeof(ut_mem_block_t)); - if (ret == NULL) { - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Fatal error: cannot allocate %lu bytes of\n" + if (ret == NULL && retry_count < 60) { + if (retry_count == 0) { + ut_print_timestamp(stderr); + + fprintf(stderr, + " InnoDB: Error: cannot allocate %lu bytes of\n" "InnoDB: memory with malloc! Total allocated memory\n" "InnoDB: by InnoDB %lu bytes. Operating system errno: %lu\n" - "InnoDB: Cannot continue operation!\n" "InnoDB: Check if you should increase the swap file or\n" "InnoDB: ulimits of your operating system.\n" "InnoDB: On FreeBSD check you have compiled the OS with\n" "InnoDB: a big enough maximum process size.\n" "InnoDB: Note that in most 32-bit computers the process\n" "InnoDB: memory space is limited to 2 GB or 4 GB.\n", + "InnoDB: We keep retrying the allocation for 60 seconds...\n", (ulong) n, (ulong) ut_total_allocated_memory, #ifdef __WIN__ (ulong) GetLastError() @@ -98,7 +102,21 @@ ut_malloc_low( (ulong) errno #endif ); + } + + os_fast_mutex_unlock(&ut_list_mutex); + /* Sleep for a second and retry the allocation; maybe this is + just a temporary shortage of memory */ + + os_thread_sleep(1000000); + + retry_count++; + + goto retry; + } + + if (ret == NULL) { /* Flush stderr to make more probable that the error message gets in the error file before we generate a seg fault */ @@ -113,8 +131,10 @@ ut_malloc_low( by graceful exit handling in ut_a(). */ #if (!defined __NETWARE__) if (assert_on_error) { + ut_print_timestamp(stderr); + fprintf(stderr, - "InnoDB: We now intentionally generate a seg fault so that\n" + " InnoDB: We now intentionally generate a seg fault so that\n" "InnoDB: on Linux we get a stack trace.\n"); if (*ut_mem_null_ptr) ut_mem_null_ptr = 0; |