Bug #31154 field.h:1649: virtual int Field_bit::cmp(const uchar*, const uchar*): Assertion
Submitted: 23 Sep 2007 12:50 Modified: 24 Oct 2007 19:35
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Data Types Severity:S2 (Serious)
Version:5.0.48-debug, 5.1.23-debug OS:Any
Assigned to: Ramil Kalimullin CPU Architecture:Any
Tags: assert, bit, crash, group_concat

[23 Sep 2007 12:50] Shane Bester
Description:
Version: '5.1.23-beta-debug'  socket: '/tmp/mysql.sock'  port: 3306  yes
mysqld: field.h:1649: virtual int Field_bit::cmp(const uchar*, const uchar*): Assertion `ptr == a' failed.
070923 14:30:19 - mysqld got signal 6;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=8388572
read_buffer_size=131072
max_used_connections=1
max_threads=151
threads_connected=1
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 337620 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x87bc4a0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0x40ca8b34, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x820111b handle_segfault + 541
0xffffe410 _end + -142173536
0x400edb75 _end + 932549125
0x400e5903 _end + 932515731
0x81e9365 Field_bit::cmp(unsigned char const*, unsigned char const*) + 53
0x816c667 group_concat_key_cmp_with_distinct(void*, unsigned char*, unsigned char*) + 117
0x84daa97 tree_insert + 72
0x816d407 Item_func_group_concat::add() + 255
0x827ada3 update_sum_func(Item_sum**) + 27
0x8274a31 end_send_group(JOIN*, st_join_table*, bool) + 1005
0x8272ad3 evaluate_join_record(JOIN*, st_join_table*, int, char*) + 445
0x82728dc sub_select(JOIN*, st_join_table*, bool) + 244
0x8272400 do_select(JOIN*, List<Item>*, st_table*, Procedure*) + 756
0x82612bf JOIN::exec() + 7053
0x826181e _Z12mysql_selectP3THDPPP4ItemP10TABLE_LISTjR4ListIS1_ES2_jP8st_orderSB_S2_SB_yP13select_resultP18st_select_lex_unitP13st_select + 638
0x825c33d handle_select(THD*, st_lex*, select_result*, unsigned long) + 365
0x8215af4 execute_sqlcom_select(THD*, TABLE_LIST*) + 772
0x820e7d5 mysql_execute_command(THD*) + 1701
0x8217550 mysql_parse(THD*, char const*, unsigned int, char const**) + 372
0x820cc00 dispatch_command(enum_server_command, THD*, char*, unsigned int) + 2354
0x820c2c2 do_command(THD*) + 600
0x820acbd handle_one_connection + 255
0x40038aa7 _end + 931807543
0x4017ec2e _end + 933143230
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://dev.mysql.com/doc/refman/5.1/en/resolve-stack-dump.html
and follow instructions on how to resolve the stack trace.
Resolved stack trace is much more helpful in diagnosing the
problem, so please do resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x87ec230 = select (group_concat(distinct `col002`)) from t1
thd->thread_id=1

How to repeat:
#run this on debug build of mysqld:

drop table if exists t1;
create table `t1` (`col002` bit not null)engine=myisam;
insert into t1 values (),(),();
select (group_concat(distinct `col002`)) from t1;
[11 Oct 2007 12:20] 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/35345

ChangeSet@1.2531, 2007-10-11 17:20:34+05:00, ramil@mysql.com +3 -0
  Fix for bug #31154: field.h:1649: virtual int Field_bit::cmp(const uchar*, const uchar*): Assertion
  
  Problem: GROUP_CONCAT(DISTINCT BIT_FIELD...) uses a tree to store keys;
  which are constructed using a temporary table fields,
  see Item_func_group_concat::setup().
  As a) we don't store null bits in the tree where the bit fields store parts 
  of their data and b) there's no method to properly compare two table records
  we've got problem.
  
  Fix: convert BIT fields to INT in the temporary table used.
[18 Oct 2007 21:34] Bugs System
Pushed into 5.1.23-beta
[18 Oct 2007 21:37] Bugs System
Pushed into 5.0.52
[24 Oct 2007 19:35] Paul DuBois
Noted in 5.0.52, 5.1.23 changelogs.

Use of GROUP_CONCAT(DISTINCT bit_column) caused an assertion failure.