Bug #5492 "set @@session.read_rnd_buffer_size=33554432" crashes server on query
Submitted: 9 Sep 2004 14:59 Modified: 4 Oct 2004 16:10
Reporter: Hartmut Holzgraefe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.0.20 OS:Windows (Windows 2000)
Assigned to: Victor Vagin CPU Architecture:Any

[9 Sep 2004 14:59] Hartmut Holzgraefe
Description:
In order to optimize our sort query execution time, I use "set @@session.read_rnd_buffer_size=33554432" to set the value during runtime, in this case the MySQL server crashes during a big sort. (I plan to use more when I will detect a lot of memory) .

I see that when I try to use 32 - 33 M in the set statement it crashes, otherwise it doesn't.

This happens on Windows 2000.
On Windows XP it doesn't seem to crash.

How to repeat:
The attached ZIP file contains an SQL dump that ends with the SET command and a sample query. Just pipe this into your client and see if it crashes or not.
[9 Sep 2004 15:07] MySQL Verification Team
On Windows 2000 only crashes the servers release version,
the debug version not crahes.
[9 Sep 2004 15:09] Hartmut Holzgraefe
status update
[9 Sep 2004 20:19] Hartmut Holzgraefe
Note: win2k is the only OS that seems to fail here, i tested on WinXP, Linux and MacOS X
and it all ran fine ,,,
[16 Sep 2004 9:00] Victor Vagin
bk commit into 4.0 tree (vva:1.2010)

ChangeSet
  1.2010 04/09/16 16:10:14 vva@eagle.mysql.r18.ru +1 -0
  Fixed Bug #5492 "set @@session.read_rnd_buffer_size=33554432" 
     crashes server on query
  
  incremented size of allocated buffer in the init_rr_cache(sql/records.cc)
  (
  We are going to read the last three bytes of the buffer via uint3korr
  This macro reads actually 4 bytes (for speed)
  So, we have to allocate one more byte at the end of the buffer 
  to avoid memory assertion fault
  )
[4 Oct 2004 16:10] Victor Vagin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

The fix will be in the mysql-4.0.22