Bug #9593 The combination of COUNT, DISTINCT and CONCAT seems to lock the server
Submitted: 3 Apr 2005 16:15 Modified: 31 May 2005 2:06
Reporter: Tim Graves Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S2 (Serious)
Version:5.0.3/5.0.4 BK OS:Windows (Windows XP)
Assigned to: Evgeny Potemkin CPU Architecture:Any

[3 Apr 2005 16:15] Tim Graves
Description:
executing SELECT COUNT(DISTINCT CONCAT(productCode,'/',majorCode)) FROM requirement WHERE productCode='M801' seems to consistently crash the MySQL server
(MyISAM tables being used) 
any other combination of COUNT, DISTINCT and CONCAT seems to be OK
The server does not seem to crash immediatly, using the MySQL client I was able to run the statement a couple of times before the server crashed
Using the DBVisualiser tool and the MySQL JABC 3.1.6 connector it crashed immediatly (or apparently so)
Using the JDBC and a Java program several subsequent statements were executed before the server crashed
This is the 5.0.3 distribution as downloaded, there have been no changes to the binaries.
It's possible that 5.0.1 had the same issue in that there were occacsional problems there but they were far less frequent.

How to repeat:
This may be specific to my database schema (it's not specific to the contents of the database) I'm happy to provide a copy of the DB and config file if needed.
Just executing 
SELECT COUNT(DISTINCT CONCAT(productCode,'/',majorCode)) FROM requirement WHERE productCode='M801'
causes the database to lock up with the following error messages
(note there are over seven hundred pages like this in the log with the sequence apparently repreating)

Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\heap\hp_open.c:41'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\uniques.cpp:65'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\mf_cache.c:65'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\mf_cache.c:66'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\mf_iocache.c:216'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:195'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_select.cpp:5731'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\lock.cpp:210'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\array.c:236'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_lex.cpp:183'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_lex.cpp:184'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\mf_iocache.c:1241'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\mf_cache.c:118'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\mf_cache.c:119'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:291'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\array.c:236'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\heap\hp_close.c:49'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\heap\hp_create.c:268'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\heap\hp_create.c:269'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_select.cpp:8630'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_select.cpp:8635'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:291'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:63'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:291'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_lex.cpp:183'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_lex.cpp:184'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_db.cpp:1020'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_db.cpp:1084'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_lex.cpp:183'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_lex.cpp:184'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:63'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:291'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_lex.cpp:183'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_lex.cpp:184'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:63'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:291'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\lock.cpp:415'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_select.cpp:3059'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:195'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:291'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:195'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\mulalloc.c:51'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_select.cpp:8126'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\ha_heap.cpp:467'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\heap\hp_create.c:132'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\heap\hp_create.c:187'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\ha_heap.cpp:558'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\heap\hp_open.c:41'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\uniques.cpp:65'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\mf_cache.c:65'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\mf_cache.c:66'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\mf_iocache.c:216'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:195'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_select.cpp:5731'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\lock.cpp:210'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\array.c:236'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_lex.cpp:183'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_lex.cpp:184'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\mf_iocache.c:1241'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\mf_cache.c:118'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\mf_cache.c:119'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:291'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\array.c:236'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\heap\hp_close.c:49'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\heap\hp_create.c:268'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\heap\hp_create.c:269'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_select.cpp:8630'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_select.cpp:8635'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:291'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:63'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:291'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_lex.cpp:183'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_lex.cpp:184'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_db.cpp:1020'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_db.cpp:1084'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_lex.cpp:183'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_lex.cpp:184'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:63'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:291'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_lex.cpp:183'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_lex.cpp:184'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:63'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:291'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\lock.cpp:415'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\sql\sql_select.cpp:3059'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:195'
Error: Memory allocated at C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:127 was overrun, discovered at 'C:\cygwin\home\mysqldev\build\mysql-5.0.3-beta-build\mysql-5.0.3-beta\mysys\my_alloc.c:291'

Suggested fix:
I admit the code that causes the problem is dumb code (whihc is why this is not severity 1) and I've been able to find a far easier way of working out the answer but it does still crash the server - hence the Severity 2 priority
[4 Apr 2005 17:28] MySQL Verification Team
Could you please provide your DB uploading the zipped file
with a name identifying this bug report at:

ftp://ftp.mysql.com/pub/mysql/upload/

Thanks in advance.
[4 Apr 2005 21:53] Tim Graves
Hi there

  I've uploaded the zip file to pub/mysql/uploads/Bug-9593-database.zip
  This contains the database directory, the config file (myOU.cnf) file for this database, the script used to create the database (DBCreate.txt) and the putput of mysqldump (db.sql)
   This problem occurs with this database (I was able to reproduce it just befor creating this zip file) It also occurs wiht another database using the same schema
   Thanks to looking at this
   Tim Graves
[5 Apr 2005 0:35] MySQL Verification Team
Thank you for the feedback I was able to repeat uisng the
Query Browser, with the mysql client not happens.

I will test the latest BK source.
[5 Apr 2005 1:10] MySQL Verification Team
The crash happens in the C Runtime Library: dbgheap.c on Windows.

Call Stack:

>	mysqld-debug.exe!_free_dbg_lk(void * pUserData=0x00ece0b0, int nBlockUse=1)  Line 1044 + 0x30	C
 	mysqld-debug.exe!_free_dbg(void * pUserData=0x00ece0b0, int nBlockUse=1)  Line 1001 + 0xd	C
 	mysqld-debug.exe!free(void * pUserData=0x00ece0b0)  Line 956 + 0xb	C
 	mysqld-debug.exe!_myfree(char * ptr=0x00ece0c8, const char * filename=0x00811a90, unsigned int lineno=179, int myflags=0)  Line 314 + 0x9	C
 	mysqld-debug.exe!String::free()  Line 179 + 0x17	C++
 	mysqld-debug.exe!String::~String()  Line 78 + 0xf	C++
 	mysqld-debug.exe!THD::~THD()  Line 422 + 0x54	C++
 	mysqld-debug.exe!THD::`scalar deleting destructor'(unsigned int __flags=1)  + 0xf	C++
 	mysqld-debug.exe!end_thread(THD * thd=0x00e4df60, int put_in_cache=1)  Line 1503 + 0x1e	C++
 	mysqld-debug.exe!handle_one_connection(void * arg=0x00e4df60)  Line 1133 + 0xb	C++
 	mysqld-debug.exe!pthread_start(void * param=0x00e7aba8)  Line 63 + 0x7	C
 	mysqld-debug.exe!_threadstart(void * ptd=0x00eac570)  Line 173 + 0xd	C
 	kernel32.dll!7c80b50b() 	
 	kernel32.dll!7c8399f3() 	
 	mysqld-debug.exe!mysql_create_function(THD * thd=0x00730065, st_udf_func * udf=0x0075006f)  Line 447 + 0x13	C++
 	mysqld-debug.exe!mysql_load(THD * thd=0x55895c51, sql_exchange * ex=0x8b08ebe8, st_table_list * table_list=0x088be845, List<Item> & fields_vars={...}, List<Item> & set_fields={...}, List<Item> & set_values={...}, enum_duplicates handle_duplicates=-1995946613, int ignore=64642, int read_file_from_client=-397571328)  Line 306 + 0x2c	C++
 	8be44d8b()
[10 Apr 2005 14:30] Tim Graves
This is perhaps a more general problem than I origionally thought, it may apply to many uses of CONCAT
If I create a view that uses concat and then select from that view the mysql client client seems to hang (DBVisualizer client via mysql JDBC 3.1.6 and mysql command line client)- it seems to be possible to initiate a new connection to the mysqlserver (I tested this using the mysql command line client).
The mysqladmin shutdown command claims to work but the mysql-debug.exe process is still left running and does not respond to shutdown requests from the MYSQL administrator or the mysql system tray monitor.
The SQL to create a view is below. The problem occurs not on creating the view but in doing a select from it (presumably because that is when the CONCAT function is actually called. 
CREATE VIEW majorAreaName AS
SELECT product.name AS productName, majorArea.name AS majorName,
	CONCAT(product.name,' / ',majorArea.name) AS name,
	majorarea.productCode AS productCode, majorarea.majorCode AS majorCode, majorArea.description AS description,
	product.importanceAdjustment * majorArea.importanceAdjustment AS importanceAdjustment
FROM product 
	INNER JOIN majorarea ON majorarea.productCode=product.productCode ;

If I create the view without the CONCAT (as shown below) then selecting from it works with no problems.
CREATE VIEW majorAreaName AS
SELECT product.name AS productName, majorArea.name AS majorName,
	majorarea.productCode AS productCode, majorarea.majorCode AS majorCode, majorArea.description AS description,
	product.importanceAdjustment * majorArea.importanceAdjustment AS importanceAdjustment
FROM product 
	INNER JOIN majorarea ON majorarea.productCode=product.productCode ;

If I do a select from the view containign the CONCAT but do not select the column generated through utilises the CONCAT then the select works OK (I guess the optimiser comes into play here and does not execute the CONCAT as it is not needed)
The following works OK on the full view
select productName, majorName, productCode, majorCode, description, importanceAdjustment from majorAreaName ;

NOTE on the optimiser 
Assuming that it is the CONCAT function that causes the problem the optimiser does not seem to cascade the lack of use to the CONCAT column
If I define a second views that uses the first view 

CREATE VIEW minorAreaName AS
SELECT majorAreaName.productName AS productName, majorAreaName.majorName AS majorName, minorArea.name AS minorName,
	CONCAT(majorAreaName.name,' / ', minorArea.name) AS name,
	majorAreaName.productCode AS productCode, majorAreaName.majorCode AS majorCode, minorArea.minorCode AS minorCode, minorArea.description AS description,
	majorAreaName.importanceAdjustment * minorArea.importanceAdjustment AS importanceAdjustment
FROM majorAreaName 
	INNER JOIN minorArea ON minorArea.productCode=majorAreaName.productCode AND minorArea.majorCode=majorAreaName.majorCode ;

then try and select from the second view like this (note I am not using the column that has the CONCAT in the minorAreaName view)

select productName, majorName, productCode, majorCode, minorCode, description, importanceAdjustment from minorAreaName ;

then the server does hang. At a guess I'd say that the optimiser ignores the CONCAT in the minorAreaName view but not in the majorAreaName view.
[25 May 2005 21:50] 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/internals/25280
[30 May 2005 9:21] Evgeny Potemkin
Freeing memory in TMP_TABLE_PARAM::cleanup() allocated by new Copy_fields[0] in 
setup_copy_fields() results in memory destruction.
[31 May 2005 2:06] Paul DuBois
Noted in 5.0.7 changelog.
[2 Jun 2005 15:25] Evgeny Potemkin
Changeset  1.1922.3.1