Bug #11464 MySQL server crashes on simple aggregate (500 rows)
Submitted: 20 Jun 2005 16:41 Modified: 20 Jun 2005 22:54
Reporter: Robert Hunt Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.12a-nt-log OS:Windows (Win XP)
Assigned to: CPU Architecture:Any

[20 Jun 2005 16:41] Robert Hunt
Description:
I've got a query that worked in 4.0 and now crashes the mysqld-nt process in 4.1 every time:
=============================================
SELECT @today:=date_format( now(), '%Y%m%d' )
;
DROP TABLE IF EXISTS trlStuff
;
CREATE TEMPORARY TABLE trlStuff
SELECT
  logdate
, max( if( item = 'serverName', data, null ) ) as host
, max( if( item = 'servletPath' and data like '%.ht%', data, null ) ) as page
, max( if( item = 'remoteAddr', data, null ) ) as ip
FROM trlHistory
WHERE left( logdate, 8 ) = @today
GROUP BY logdate
HAVING page IS NOT NULL
;
/* the above produces about 500 rows; it's the next SELECT that crashes the 
computer */
SELECT
  host
, page
, count(*) as hits
, count( distinct ip ) as visitors
FROM trlStuff
GROUP BY host, page
;
==========================================

trlhistory is defined as:
+---------+----------------------------+------+-----+---------+-------+
| Field   | Type                       | Null | Key | Default | Extra |
+---------+----------------------------+------+-----+---------+-------+
| logdate | varchar(20)                | YES  | MUL | [NULL]  |       |
| http    | enum('request','response') | YES  |     | [NULL]  |       |
| item    | varchar(64)                | YES  |     | [NULL]  |       |
| data    | text                       | YES  |     | [NULL]  |       |
+---------+----------------------------+------+-----+---------+-------+

How to repeat:
Run the query
[20 Jun 2005 16:56] MySQL Verification Team
Yes please provide the dump file at:

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

with a name identifying this bug report's number.

Thanks in advance.
[20 Jun 2005 17:52] MySQL Verification Team
Could you please provide the table definition and with data for
to try the crash on my side. You can use the mysqldump client
tool for.

Thanks in advance.
[20 Jun 2005 19:12] MySQL Verification Team
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:

I was able for to repeat with server 4.1.12, however with server built
from BK the crash not happens anymore:

mysql> SELECT
    ->   host
    -> , page
    -> , count(*) as hits
    -> , count( distinct ip ) as visitors
    -> FROM trlStuff
    -> GROUP BY host, page
    -> ;
+---------------------------+---------------------------------------------------------------+------+----------+
| host                      | page                                                          | hits | visitors |
+---------------------------+---------------------------------------------------------------+------+----------+
| gp-n.lnal.com             | /redirect.htm                                                 |    1 |        1 |
| gp-n.lnal.com             | /registration/summerLeague2005.htm/storeForm/SummerLeague2005 |    1 |        1 |
| greenphantom.net          | /index.html                                                   |    1 |        1 |
| hockomocksummerleague.com | /calendar/eventForm.htm                                       |   16 |        8 |
| hockomocksummerleague.com | /calendar/index.htm                                           |  160 |       53 |
| hockomocksummerleague.com | /calendar/onDeck.htm                                          |   79 |       58 |
| hockomocksummerleague.com | /calendar/showDaySched.htm                                    |   24 |       11 |
| hockomocksummerleague.com | /contacts/boardOfDirectors.htm                                |    6 |        6 |
| hockomocksummerleague.com | /contacts/divisionScorekeepers.htm                            |    5 |        5 |
| hockomocksummerleague.com | /contacts/index.htm                                           |   15 |       14 |
| hockomocksummerleague.com | /contacts/managers.htm                                        |   15 |       13 |
| hockomocksummerleague.com | /contacts/protestCommittee.htm                                |    2 |        2 |
| hockomocksummerleague.com | /index.htm                                                    |   88 |       64 |
| hockomocksummerleague.com | /info/byLaws.htm                                              |    2 |        1 |
| hockomocksummerleague.com | /info/fieldDirections.htm                                     |   23 |       22 |
| hockomocksummerleague.com | /info/index.htm                                               |   28 |       21 |
| hockomocksummerleague.com | /info/meetingMinutes.htm                                      |    4 |        4 |
| hockomocksummerleague.com | /info/playingRules.htm                                        |    9 |        6 |
| hockomocksummerleague.com | /links/index.htm                                              |   17 |       15 |
| hockomocksummerleague.com | /teams/gameScores.htm                                         |    5 |        5 |
| hockomocksummerleague.com | /teams/scoreForm.htm                                          |    1 |        1 |
| hockomocksummerleague.com | /teams/teamStandings.htm                                      |   38 |       32 |
+---------------------------+---------------------------------------------------------------+------+----------+
22 rows in set (0.05 sec)

mysql> select version();
+--------------+
| version()    |
+--------------+
| 4.1.13-debug |
+--------------+
1 row in set (0.00 sec)

mysql>
[20 Jun 2005 19:51] Robert Hunt
Is there any other way to get a later build?  I can only use pre-built binaries -- the only compiler I've got installed is Java (believe it or not).
[20 Jun 2005 22:54] MySQL Verification Team
Sorry, the only way you can get the current source server is building it
yourself and for that you need VC++ 6.0 compiler.