1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-26533 MariaDB 10.5 crashes with key_buffer_size > 4Gb on Windows x64

This is a side-effect of my_large_malloc() introduction,MDEV-18851

It removed a cast to size_t to variable 'blocks' in
multiplication blocks * keycache->key_cache_block_size , creating ulong value
instead of correct size_t.


Replaced a couple of ulongs with appropriate data type, which is size_t.

Also, fixed casts to ulongs in crash handler messages, so that people would
not be confused by that, too.

Interestingly, aria did not expose the same problem even if it contains
copied and pasted code in ma_pagecache, because Aria had some ulongs removed
when fixing a similar problem in MDEV-9256.
This commit is contained in:
Vladislav Vaintroub
2021-09-04 17:38:47 +02:00
parent e38a05e20a
commit a1b0f23586
2 changed files with 23 additions and 24 deletions

View File

@ -173,19 +173,19 @@ extern "C" sig_handler handle_fatal_signal(int sig)
my_safe_printf_stderr("Server version: %s\n", server_version);
if (dflt_key_cache)
my_safe_printf_stderr("key_buffer_size=%lu\n",
(ulong) dflt_key_cache->key_cache_mem_size);
my_safe_printf_stderr("key_buffer_size=%zu\n",
dflt_key_cache->key_cache_mem_size);
my_safe_printf_stderr("read_buffer_size=%ld\n",
(long) global_system_variables.read_buff_size);
my_safe_printf_stderr("read_buffer_size=%lu\n",
global_system_variables.read_buff_size);
my_safe_printf_stderr("max_used_connections=%lu\n",
(ulong) max_used_connections);
max_used_connections);
if (thread_scheduler)
my_safe_printf_stderr("max_threads=%u\n",
(uint) thread_scheduler->max_threads +
(uint) extra_max_connections);
thread_scheduler->max_threads +
extra_max_connections);
my_safe_printf_stderr("thread_count=%u\n", THD_count::value());
@ -194,11 +194,10 @@ extern "C" sig_handler handle_fatal_signal(int sig)
my_safe_printf_stderr("It is possible that mysqld could use up to \n"
"key_buffer_size + "
"(read_buffer_size + sort_buffer_size)*max_threads = "
"%lu K bytes of memory\n",
(ulong)
"%zu K bytes of memory\n",
(dflt_key_cache->key_cache_mem_size +
(global_system_variables.read_buff_size +
global_system_variables.sortbuff_size) *
(size_t)global_system_variables.sortbuff_size) *
(thread_scheduler->max_threads + extra_max_connections) +
(max_connections + extra_max_connections) *
sizeof(THD)) / 1024);