Bug #54459 Assertion failed: param.sort_length, file .\filesort.cc, line 149 (part II)
Submitted: 12 Jun 2010 18:25 Modified: 15 Oct 2010 10:54
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S1 (Critical)
Version:5.0.91-debug, 5.1.47-debug, 5.5.3-debug, 5.5.5-m3-debug OS:Any
Assigned to: Ramil Kalimullin CPU Architecture:Any
Tags: assertion

[12 Jun 2010 18:25] Shane Bester
Description:
seems fix for bug #52164 was incomplete.  5.1.47-debug stack trace:

Version: '5.1.47-enterprise-gpl-advanced-debug'  socket: ''  port: 3306  MySQL Enterprise Server - Advanced Edition Debug (GPL)
Assertion failed: param.sort_length, file .\filesort.cc, line 146

mysqld-debug.exe!my_sigabrt_handler()[mysqld.cc:2049]
mysqld-debug.exe!raise()[winsig.c:590]
mysqld-debug.exe!abort()[abort.c:71]
mysqld-debug.exe!_wassert()[assert.c:212]
mysqld-debug.exe!filesort()[filesort.cc:146]
mysqld-debug.exe!create_sort_index()[sql_select.cc:13768]
mysqld-debug.exe!JOIN::exec()[sql_select.cc:2263]
mysqld-debug.exe!mysql_select()[sql_select.cc:2511]
mysqld-debug.exe!handle_select()[sql_select.cc:269]
mysqld-debug.exe!execute_sqlcom_select()[sql_parse.cc:5067]
mysqld-debug.exe!mysql_execute_command()[sql_parse.cc:2263]
mysqld-debug.exe!mysql_parse()[sql_parse.cc:5986]
mysqld-debug.exe!dispatch_command()[sql_parse.cc:1233]
mysqld-debug.exe!do_command()[sql_parse.cc:874]
mysqld-debug.exe!handle_one_connection()[sql_connect.cc:1134]
mysqld-debug.exe!pthread_start()[my_winthread.c:85]
mysqld-debug.exe!_callthreadstart()[thread.c:293]
mysqld-debug.exe!_threadstart()[thread.c:277]

release build does not crash.

How to repeat:
#run on debug build:

drop table if exists t1;
create table t1(a enum('')not null)engine=myisam charset=latin1;
insert into t1 values (),(),();
select 1 from t1 order by a collate latin1_german2_ci;
[12 Jun 2010 19:16] Valeriy Kravchuk
Verified just as described, also with recent mysql-trunk on Mac OS X:

Version: '5.5.5-m3-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
Assertion failed: (param.sort_length), function filesort, file filesort.cc, line 153.
100612 22:13:25 - mysqld got signal 6 ;
[24 Jun 2010 8:02] 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/commits/112028

3438 Ramil Kalimullin	2010-06-24
      Fix for bug #54459: Assertion failed: param.sort_length, 
      file .\filesort.cc, line 149 (part II)
      
      Problem: the server didn't disregard sort order 
      for some zero length tuples.
      
      Fix: skip sort order in such a case 
      (zero length NOT NULL string functions).
     @ mysql-test/r/select.result
        Fix for bug #54459: Assertion failed: param.sort_length, 
        file .\filesort.cc, line 149 (part II)
          - test result.
     @ mysql-test/t/select.test
        Fix for bug #54459: Assertion failed: param.sort_length, 
        file .\filesort.cc, line 149 (part II)
          - test case.
     @ sql/sql_select.cc
        Fix for bug #54459: Assertion failed: param.sort_length, 
        file .\filesort.cc, line 149 (part II)
          - disregard sort order for zero length NOT NULL string functions
        along with zero length NOT NULL fields.
[19 Jul 2010 14:33] Bugs System
Pushed into 5.1.49 (revid:build@mysql.com-20100719143034-omcma40sblwmay3x) (version source revid:ramil@mysql.com-20100624080048-sk7qswz5wzmha83e) (merge vers: 5.1.48) (pib:16)
[19 Jul 2010 19:33] Paul DuBois
Noted in 5.1.49 changelog.

The server failed to disregard sort order for some zero-length
tuples, leading to an assertion failure. 

Setting report to Need Merge pending further pushes.
[23 Jul 2010 12:21] Bugs System
Pushed into mysql-trunk 5.5.6-m3 (revid:alik@sun.com-20100723121820-jryu2fuw3pc53q9w) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:18)
[23 Jul 2010 12:28] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100723121929-90e9zemk3jkr2ocy) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (pib:18)
[23 Jul 2010 17:11] Paul DuBois
Noted in 5.5.6 changelog.
[14 Oct 2010 8:26] Bugs System
Pushed into mysql-5.1-telco-7.0 5.1.51-ndb-7.0.20 (revid:martin.skold@mysql.com-20101014082627-jrmy9xbfbtrebw3c) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:21)
[14 Oct 2010 8:40] Bugs System
Pushed into mysql-5.1-telco-6.3 5.1.51-ndb-6.3.39 (revid:martin.skold@mysql.com-20101014083757-5qo48b86d69zjvzj) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:21)
[14 Oct 2010 8:55] Bugs System
Pushed into mysql-5.1-telco-6.2 5.1.51-ndb-6.2.19 (revid:martin.skold@mysql.com-20101014084420-y54ecj85j5we27oa) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:21)
[15 Oct 2010 10:54] Jon Stephens
Already documented in the 5.1.49 changelog. No new changelog entries required. Reverting to Closed state.