Bug #55002 Join buffer allocation fails silently
Submitted: 5 Jul 2010 14:49 Modified: 5 Aug 2010 21:08
Reporter: Baron Schwartz (Basic Quality Contributor) Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: qc

[5 Jul 2010 14:49] Baron Schwartz
Description:
It looks like success of buffer allocation isn't checked.

How to repeat:
set session join_buffer_size = 1 >> 30; # 1GB
select * from
(select 1 union select 1) as x1
join (select 1 union select 1) as x2;

Nothing happens -- the query runs okay -- but, strace says:

13:39:41.057876 mmap2(NULL, 1073745920, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory)
[5 Jul 2010 15:43] Baron Schwartz
Actually I need to revise my comment.  It IS checked, and if allocation fails then nothing happens (the buffer simply isn't used), but the user is not notified of this.  I think there should be a warning or error in the log.
[5 Jul 2010 21:08] Sveta Smirnova
Thank you for the report.

I can not repeat described behavior. Which exact version of MySQL do you use?
[5 Aug 2010 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".