Bug #10689 mysql 4.0.24 runs fine for a few minutes, but then starts to use 4 GB of RAM
Submitted: 17 May 2005 15:21 Modified: 2 Jun 2005 16:54
Reporter: bart dom Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Installing Severity:S1 (Critical)
Version:4.0.24 on itanium2 OS:Linux (RHEL 3 AS)
Assigned to: Matthew Lord CPU Architecture:Any

[17 May 2005 15:21] bart dom
Description:
I have just tried to migrate a server to a RHEL 3 AS for itanium2 system.
The servers starts fine but after a few seconds starts to use all available system-memory and crashes because it cannot get any more memory.
At that time the system has only around 50-60 connections.
This is the error i get:

mysqld got signal 11;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=8388600
read_buffer_size=131072
max_used_connections=215
max_connections=1024
threads_connected=217
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 2236407 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Strange thing is that the system has 4GB of RAM, so it should not run out of it.
I did realise that max_join_size is set to a VERY high value by default:

 max_allowed_packet              | 16776192                                                                                                                                                                                                          |
| max_binlog_cache_size           | 4294967295                                                                                                                                                                                                        |
| max_binlog_size                 | 1073741824                                                                                                                                                                                                        |
| max_connections                 | 1024                                                                                                                                                                                                              |
| max_connect_errors              | 2048                                                                                                                                                                                                              |
| max_delayed_threads             | 20                                                                                                                                                                                                                |
| max_insert_delayed_threads      | 20                                                                                                                                                                                                                |
| max_heap_table_size             | 16777216                                                                                                                                                                                                          |
| max_join_size                   | 18446744073709551615                                                                                                                                                                                              |
| max_relay_log_size              | 0                                                                                                                                                                                                                 |
| max_seeks_for_key               | 4294967295                                                                                                                                                                                                        |
| max_sort_length                 | 1024                                                                                                                                                                                                              |
| max_user_connections            | 0                                                                                                                                                                                                                 |
| max_tmp_tables                  | 32                                                                                                                                                                                                                |
| max_write_lock_count            | 4294967295                                                                                                                                                                                                        |
| myisam_max_extra_sort_file_size | 268435456                                                                                                                                                                                                         |
| myisam_max_sort_file_size       | 9223372036854775807      

How can i limit mysql to use a max amount of memory per query?

thx

How to repeat:
Since the system has over 1000 databases on it i did not find a way to find the query causing this, but it has t be related to a specific query since the crash-time varies from a few seconds to 5 minutes.
[2 Jun 2005 16:53] Matthew Lord
Hi Bart,

Thank you for your bug report!

We need a repeatable test case to proceed using this avenue.  If you have a support contract please open an issue with us.  If you do not you can use any of these community based avenues:
mysql.com/IRC
forums.mysql.com
lists.mysql.com

Best Regards