Bug #43082 mysqld 32 bit cannot use big buffers due to 2GB usermode address space limit
Submitted: 21 Feb 17:34 Modified: 18 Mar 16:53
Reporter: Vladislav Vaintroub
Status: Closed
Category:Server: Compiling Severity:S3 (Non-critical)
Version:5.0,5.1 OS:Microsoft Windows
Assigned to: Vladislav Vaintroub Target Version:5.0+
Triage: Triaged: D3 (Medium)

[21 Feb 17:34] Vladislav Vaintroub
Description:
Windows allows for more than 2GB virtual address space for 32 bit application
On 32 bit Windows, boot option /3GB would give application 3GB and kernel 1GB space. On
64 bit Windows, 32 bit application will get 4GB address space.

For this to happen, application should be linked with /LARGEADDRESSAWARE link option
(meaning normally, that app does not cast addresses to signed int). Clearly MySQL is
large address aware, since is already handles user space addresses > 2GB on Linux.

There are workarounds link using editbin to set LARGEADDRESSAWARE post build
(s. http://harrison-fisk.blogspot.com/2009/02/mysql-windows-32-bit-and-3gb.html)
but such workarounds  will tamper executable making digital signature invalid.

It is much better to provide the option by default (yes, it is even better if customer
uses 64 bit mysqld.exe on 64 bit Windows, but buying new hardware/OS isn't always an
option)

How to repeat:
Probably the simplest way to reproduce is trying to use 
innodb_buffer_pool_size=2G  win 32 bit mysqld.exe on 64 bit Windows.

Another way is to boot 32 bit Windows with /3GB and try innodb_buffer_pool_size=2G

Suggested fix:
use /LARGEADDRESSAWARE linker option when linking x86 mysqld
[23 Feb 16:09] Harrison Fisk
It is possible to set this flag in the binary mysqld-nt.exe, see:

http://harrison-fisk.blogspot.com/2009/02/mysql-windows-32-bit-and-3gb.html

I imagine this would cause issue with signed executables however, so it isn't an ideal
solution.

In addition, it requires you to have visual studio installed which is a bit of a pain for
some users.
[23 Feb 16:24] Vladislav Vaintroub
invalid signature after editbin /LARGEADDRESSAWARE mysqld.exe

Attachment: signature.png (image/x-png, text), 25.53 KiB.

[25 Feb 12:33] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/67517

2820 Vladislav Vaintroub	2009-02-25
      Bug#43082: mysqld 32 bit cannot use big buffers due to 2GB usermode address space
limit
      
      Fix: use /LARGEADDRESSAWARE link option when linking 32 bit executables
[25 Feb 16:58] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/67572

2764 Vladislav Vaintroub	2009-02-25
      Bug#43082: mysqld 32 bit cannot use big buffers due to 2GB
      usermode address space limit.
      
      Fix: use /LARGEADDRESSAWARE link option when linking 32 bit
      executables
[9 Mar 15:13] Bugs System
Pushed into 5.0.79 (revid:joro@sun.com-20090309135922-a0di9ebkxoj4d4wv) (version source
revid:staale.smedseng@sun.com-20090227160758-td4jot2la75f9zy1) (merge vers: 5.0.79)
(pib:6)
[11 Mar 3:00] Paul DuBois
Noted in 5.0.79 changelog.

On 32-bit Windows, mysqld could not use large buffers due to a 2GB 
user mode address limit.

Setting report to NDI pending push into 5.1.x/6.0.x.
[13 Mar 20:08] Bugs System
Pushed into 5.1.33 (revid:joro@sun.com-20090313111355-7bsi1hgkvrg8pdds) (version source
revid:vvaintroub@mysql.com-20090225160234-cytgd3f8sdayslex) (merge vers: 5.1.33) (pib:6)
[13 Mar 21:22] Paul DuBois
Noted in 5.1.33 changelog.

Setting report to NDI pending push into 6.0.x.
[18 Mar 14:19] Bugs System
Pushed into 6.0.11-alpha (revid:joro@sun.com-20090318122208-1b5kvg6zeb4hxwp9) (version
source revid:vvaintroub@mysql.com-20090225161348-n1v5oo3ab5zw0jcx) (merge vers:
6.0.10-alpha) (pib:6)
[18 Mar 16:53] Paul DuBois
Noted in 6.0.11 changelog.
[9 May 18:47] Bugs System
Pushed into 5.1.34-ndb-6.2.18 (revid:jonas@mysql.com-20090508185236-p9b3as7qyauybefl)
(version source revid:jonas@mysql.com-20090508100057-30ote4xggi4nq14v) (merge vers:
5.1.33-ndb-6.2.18) (pib:6)
[9 May 19:43] Bugs System
Pushed into 5.1.34-ndb-6.3.25 (revid:jonas@mysql.com-20090509063138-1u3q3v09wnn2txyt)
(version source revid:jonas@mysql.com-20090508175813-s6yele2z3oh6o99z) (merge vers:
5.1.33-ndb-6.3.25) (pib:6)
[9 May 20:41] Bugs System
Pushed into 5.1.34-ndb-7.0.6 (revid:jonas@mysql.com-20090509154927-im9a7g846c6u1hzc)
(version source revid:jonas@mysql.com-20090509073226-09bljakh9eppogec) (merge vers:
5.1.33-ndb-7.0.6) (pib:6)