Bug #15150 malloc error when pasting length query
Submitted: 22 Nov 2005 21:12 Modified: 30 Dec 2005 7:31
Reporter: James Stewart Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0.15 OS:MacOS (OSX Server: Kernel Version 8.2.0)
Assigned to: CPU Architecture:Any

[22 Nov 2005 21:12] James Stewart
Description:
I attempted to copy and paste the query:

SELECT SQL_CALC_FOUND_ROWS COUNT(DISTINCT products.Keyword_Name) AS tally, products.* FROM (SELECT Product.Product_ID, Product_Set.Product_Set_ID, Product_Set_Product_Description.Title, Product_Set_Product_Description.Effective_Date AS desc_effect, Product_Set_Product_Price.Price, Product_Set_Product_Price.Effective_Date AS price_effect, Product_Keyword.Keyword_Name FROM Product, Product_Set, Product_Set_Product, Product_Set_Product_Description, Product_Set_Product_Price, Product_Keyword WHERE Product_Set_Product.Product_ID = Product.Product_ID AND Product_Set_Product.Product_Set_ID = Product_Set.Product_Set_ID AND Product_Set_Product_Description.Product_ID = Product_Set_Product.Product_ID AND Product_Set_Product_Description.Product_Set_ID = Product_Set_Product.Product_Set_ID AND Product_Set_Product_Price.Product_ID = Product_Set_Product.Product_ID AND Product_Set_Product_Price.Product_Set_ID = Product_Set_Product.Product_Set_ID AND Product_Set_Product_Description.Effective_Date <= NOW() AND Product_Set_Product_Price.Effective_Date <= NOW() AND (Product_Set_Product.Discontinue_Date IS NULL OR Product_Set_Product.Discontinue_Date = '0000-00-00 00:00:00' OR Product_Set_Product.Discontinue_Date > NOW()) AND Product.Product_Status_ID = 1 AND Product_Set.Status_ID = 'A' AND Product_Keyword.Product_ID = Product_Set_Product.Product_ID AND (Product.Long_Name LIKE '%Watch%' OR Product_Keyword.Keyword_Name LIKE '%Watch%') AND Product_Set_Product.Product_Set_ID = 7560 ORDER BY price_effect DESC, desc_effect DESC) AS products GROUP BY products.Product_ID

Into the MySQL client running on the command line in an SSH session. MySQL did not die, but I did receive the error:

mysql(10251) malloc: *** error: can't allocate region
mysql(10251) malloc: *** set a breakpoint in szone_error to debug
mysql(10251) malloc: *** vm_allocate(size=4294946816) failed (error code=3)
mysql(10251) malloc: *** error: can't allocate region
mysql(10251) malloc: *** set a breakpoint in szone_error to debug
mysql(10251) malloc: *** vm_allocate(size=4294946816) failed (error code=3)
mysql(10251) malloc: *** error: can't allocate region
mysql(10251) malloc: *** set a breakpoint in szone_error to debug 

How to repeat:
Attempting the same operation again (after quitting and reopening the client) returned the same error
[28 Nov 2005 10:01] Valeriy Kravchuk
Thank you for a problem report. Can you, please, try to put that "long" statement into a separate file and then use it as a source in mysql client. Will you get the same malloc error?

How much memory do you have? Can it be a hardware failure or just an overloaded server?
[29 Nov 2005 22:00] James Stewart
Putting the statement in a file worked fine, and that was the workaround I tried after submitting the bug. The server has 1GB of RAM, and didn't seem to be suffering any memory problems at the time (I don't currently have access to it, but can try and get access again to do more testing).
[30 Nov 2005 7:31] Valeriy Kravchuk
So, as it works from file, the problem may be not in mysql client itself, but in "copy and paste" process/application you copied the text from. Can you, please, try to copy from other text editors/terminal emulators etc. What exact version of Mac OS X is used?

Is that client from official MySQL binaries or your compiled it yourself fro sources?
[1 Jan 2006 0: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".