Bug #4157 #2013 - Lost connection to MySQL server during query
Submitted: 16 Jun 2004 1:09 Modified: 18 Jun 2004 0:41
Reporter: Mojenkov Evegny Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.0.18 OS:FreeBSD (freebsd 5.0/win xp)
Assigned to: Michael Widenius

[16 Jun 2004 1:09] Mojenkov Evegny
Description:
I have myisam table
CREATE TABLE price_test(
id int( 11 ) unsigned NOT NULL AUTO_INCREMENT ,
line int( 5 ) unsigned NOT NULL default '0',
columnid int( 3 ) unsigned NOT NULL default '0',
owner int( 3 ) unsigned NOT NULL default '0',
ordinal int( 3 ) unsigned NOT NULL default '0',
showid smallint( 6 ) unsigned NOT NULL default '1',
tableid int( 1 ) unsigned NOT NULL default '1',
content int( 5 ) unsigned NOT NULL default '188',
PRIMARY KEY ( owner, id ) ,
KEY menu( owner, showid, columnid ) ,
KEY COLUMN ( owner, columnid, line ) ,
KEY LINES ( owner, tableid, content, id ) ,
KEY recount( owner, line ) 
) TYPE = MYISAM ;
And give a request to database from php: 
SELECT id, columnid, tableid, content, showid, line, ordinal
FROM price_test
WHERE owner =11 AND (
(
columnid
IN ( 15, 13, 14 ) AND line
IN ( 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 31 ) 
) OR (
columnid
IN ( 13, 14 ) AND line
IN ( 15 ) 
)
)
LIMIT 0 , 30
I hopes to get an answer like an array with valid data but at freebsd 5.0 OS I have this error message, in win xp(mysql 4.0.13-nt) mysql daemon is closed by windows OS(pragram was terminated) 

How to repeat:
stright execute this query
[16 Jun 2004 1:10] Mojenkov Evegny
I find in google that extra parametr in my.cnf like  thread_stack=256k can make me happy. But not. :(
[16 Jun 2004 1:29] Mojenkov Evegny
I get an experiment and delete all keys... my query begin execute ok..
after that i check that trouble in key KEY COLUMN ( owner, columnid, line )..
I delete the third field in this key and query is ok..
I think this a curiosly bug..
[18 Jun 2004 0:41] Michael Widenius
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:

Fix will be in 4.0.21 and 4.1.3

The problem was that we missed a case in the range optimizer when a part of a shared sub tree was modified (sorry, not easy to explain).

Thanks for the example;  It helped us find the bug quite fast!

Regards,
Monty