Bug #31435 ha_innodb.cc:3983: ulint convert_search_mode_to_innobase(ha_rkey_function): Asse
Submitted: 7 Oct 2007 18:31 Modified: 18 Jun 2010 1:56
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: GIS Severity:S3 (Non-critical)
Version:5.1.22-debug,5.0.50-debug OS:Any
Assigned to: Alexey Botchkov CPU Architecture:Any
Tags: assertion

[7 Oct 2007 18:31] Shane Bester
Description:
Version: '5.1.23-beta-debug'  socket: '/tmp/mysql.sock'  port: 3306  yes
mysqld: handler/ha_innodb.cc:3983: ulint convert_search_mode_to_innobase(ha_rkey_function): Assertion `0' failed.
071007 20:09:38 - 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=2
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: 0x42900498
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=0x428a94e8, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x820147b handle_segfault + 541
0x4003f105 _end + 931835445
0x4012d1f1 _end + 932810529
0x4003c44b _end + 931823995
0x4012cf84 _end + 932809908
0x4012e498 _end + 932815304
0x40126223 _end + 932781907
0x83bba56 ha_innobase::records_in_range(unsigned int, st_key_range*, st_key_range*) + 716
0x82e15c2 check_quick_keys(PARAM*, unsigned int, SEL_ARG*, unsigned char*, unsigned int, int, unsigned char*, unsigned int, int) + 1936
0x82e0cc1 check_quick_select(PARAM*, unsigned int, SEL_ARG*, bool) + 431
0x82dbed6 get_key_scans_params(PARAM*, SEL_TREE*, bool, bool, double) + 418
0x82d7dcd SQL_SELECT::test_quick_select(THD*, Bitmap<64u>, unsigned long long, unsigned long long, bool) + 2139
0x8261cfe get_quick_record_count(THD*, SQL_SELECT*, st_table*, Bitmap<64u> const*, unsigned long long) + 158
0x82631cf make_join_statistics(JOIN*, TABLE_LIST*, Item*, st_dynamic_array*) + 5135
0x825dd0f JOIN::optimize() + 1889
0x8261b29 _Z12mysql_selectP3THDPPP4ItemP10TABLE_LISTjR4ListIS1_ES2_jP8st_orderSB_S2_SB_yP13select_resultP18st_select_lex_unitP13st_select + 553
0x8293a0e mysql_multi_update(THD*, TABLE_LIST*, List<Item>*, List<Item>*, Item*, unsigned long long, enum_duplicates, bool, st_select_lex_unit*, st_select_lex*) + 360
0x8210a9d mysql_execute_command(THD*) + 9741
0x82178b0 mysql_parse(THD*, char const*, unsigned int, char const**) + 372
0x820cf60 dispatch_command(enum_server_command, THD*, char*, unsigned int) + 2354
0x820c622 do_command(THD*) + 600
0x820b01d handle_one_connection + 255
0x40038e31 _end + 931810145
0x401be6fa _end + 933405738
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...

How to repeat:
uploading testcase tomorrow.
[8 Oct 2007 5:52] MySQL Verification Team
#testcase:

drop table if exists `t`;
create table `t` (`c` int,key(`c`))engine=innodb;
update `t` set `c`=1 where (mbrtouches(`c`,1));

#only debug versions affected by the assertion.
If find_flag is any of these:
HA_READ_MBR_CONTAIN
HA_READ_MBR_INTERSECT
HA_READ_MBR_WITHIN
HA_READ_MBR_DISJOINT
HA_READ_MBR_EQUAL
[8 Oct 2007 5:53] MySQL Verification Team
debugger outputs of 5.0.50-debug on windows

Attachment: bug31435_output_debugger.txt (text/plain), 3.74 KiB.

[8 Oct 2007 13:00] Heikki Tuuri
I think this is a MySQL server bug. The function:

"
/*************************************************************************
Estimates the number of index records in a range. */

ha_rows
ha_innobase::records_in_range(
/*==========================*/
                                                /* out: estimated number of
                                                rows */
        uint                    keynr,          /* in: index number */
        key_range               *min_key,       /* in: start key value of the
                                                   range, may also be 0 */
        key_range               *max_key)       /* in: range end key val, may
                                                   also be 0 */
"

is supposed to estimate the number of records in a given index range.

MBR is a geographic index type. InnoDB does not support it. MySQL should never ask InnoDB about MBR ranges.

"
spatial.h:47:struct MBR
spatial.h:51:  MBR()
spatial.h:57:  MBR(const double xmin_arg, const double ymin_arg,
spatial.h:62:  MBR(const st_point_2d &min, const st_point_2d &max)
spatial.h:68:    /* Not using "else" for proper one point MBR calculation */
spatial.h:85:  void add_mbr(const MBR *mbr)
spatial.h:97:  int equals(const MBR *mbr)
spatial.h:104:  int disjoint(const MBR *mbr)
spatial.h:111:  int intersects(const MBR *mbr)
spatial.h:116:  int touches(const MBR *mbr)
spatial.h:127:  int within(const MBR *mbr)
spatial.h:134:  int contains(const MBR *mbr)
"

Regards,

Heikki
[5 Nov 2007 19:27] Artem Russakovskii
Same error just happened to our production server. I will file a ticket if I'm able to create a simple test case. This should be brought up in severity. No query should crash the server completely.

The db machine has 16GB of RAM. The table is InnoDB. The query mistakenly tries to use "CONTAINS", which needs FULLTEXT index and is not supported in InnoDB as far as I know. But again, NO query should crash the server.

mysqld: ha_innodb.cc:3903: ulint convert_search_mode_to_innobase(ha_rkey_function): Assertion `0' failed.
071105 18:11:05 - 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=33554432
read_buffer_size=2093056
max_used_connections=307
max_threads=1024
threads_connected=300
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 10523440 K
bytes of memory 
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x35072b0
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=0x462ac1a8, backtrace may not be correct. 
Stack range sanity check OK, backtrace follows:
(nil)
New value of fp=0x35072b0 failed sanity check, terminating stack trace!
Please read http://dev.mysql.com/doc/mysql/en/using-stack-trace.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 0x3644840 = select * from REPLACED_BY_ME where REPLACED_BY_ME and contains(REPLACED_BY_ME , '/REPLACED_BY_ME/')
thd->thread_id=1304
The manual page at http://www.mysql.com/doc/en/Crashing.html contains 
information that should help you find out what is causing the crash.

Number of processes running now: 0
071105 18:11:06  mysqld restarted
071105 18:11:06  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
[5 Nov 2007 20:45] Artem Russakovskii
Bug #32125 filed.
[20 Nov 2007 8:45] MySQL Verification Team
Heikki please confirm if this bug and bug #32125 are duplicates ?
[24 Feb 2008 9:54] MySQL Verification Team
the office 5.1.23-debug now asserts with this stack trace...
this is likely to be another bug though.

Assertion failed: ! is_set(), file .\sql_class.cc, line 389

mysqld.exe!_NMSG_WRITE
mysqld.exe!abort
mysqld.exe!_wassert
mysqld.exe!Diagnostics_area::set_ok_status
mysqld.exe!send_ok
mysqld.exe!mysql_update
mysqld.exe!mysql_execute_command
mysqld.exe!mysql_parse
mysqld.exe!dispatch_command
mysqld.exe!do_command
mysqld.exe!handle_one_connection
mysqld.exe!pthread_start
mysqld.exe!_callthreadstart
mysqld.exe!_threadstart
kernel32.dll!BaseThreadStart

The release build correctly returns
ERROR 1464 (HY000): The used table type doesn't support SPATIAL indexes

So, I think this bug should be closed?
[2 Oct 2008 14:40] Konstantin Osipov
Fails in 6.0 with a different assert:
Version: '6.0.8-alpha-valgrind-max-debug'  socket: '/opt/local/var/mysql/mysql.sock'  port: 3307  Source distribution
mysqld: sql_class.cc:412: void Diagnostics_area::set_ok_status(THD*, ha_rows, ulonglong, const char*): Assertion `! is_set()' failed.
[1]    20648 abort (core dumped)  ./mysqld

Please re-triage. This is badly broken.
[11 Nov 2008 12:06] 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/58444

2711 Alexey Botchkov	2008-11-11
      Bug#31435 ha_innodb.cc:3983: ulint convert_search_mode_to_innobase(ha_rkey_function): Asse 
          I think we don't need to issue an error statement in the convert_search_mode_to_innobase().
          Returning the PAGE_CUR_UNSUPP value is enough as allows to handle this
          case depending on the requirements.
      
      per-file comments:
        sql/ha_innodb.cc 
      Bug#31435 ha_innodb.cc:3983: ulint convert_search_mode_to_innobase(ha_rkey_function): Asse 
           no error issued in convert_search_mode_to_innobase.
           ha_innobase::records_in_range() returns HA_POS_ERROR if search mode isn't supported.
[16 Nov 2008 16:40] Sergey Petrunya
Ok to push after email review feedback is addressed.
[9 Mar 2009 14:12] Bugs System
Pushed into 5.0.79 (revid:joro@sun.com-20090309135922-a0di9ebkxoj4d4wv) (version source revid:aelkin@mysql.com-20090224143545-7xc77386o8mg623c) (merge vers: 5.0.79) (pib:6)
[13 Mar 2009 16:55] Paul DuBois
Noted in 5.0.79 changelog.

Use of MBR spatial functions such as MBRTouches() with columns of
InnoDB tables caused a server crash rather than an error.

Setting report to NDI pending push into 5.1.x/6.0.x.
[13 Mar 2009 19:07] Bugs System
Pushed into 5.1.33 (revid:joro@sun.com-20090313111355-7bsi1hgkvrg8pdds) (version source revid:patrick.crews@sun.com-20090225081629-ent6zn9d1lt6bx68) (merge vers: 5.1.33) (pib:6)
[13 Mar 2009 20:14] Paul DuBois
Noted in 5.1.33 changelog.

Setting report to NDI pending push into 6.0.x.
[18 Mar 2009 13:18] Bugs System
Pushed into 6.0.11-alpha (revid:joro@sun.com-20090318122208-1b5kvg6zeb4hxwp9) (version source revid:holyfoot@mysql.com-20090224115659-ju15jcofiff051zw) (merge vers: 6.0.10-alpha) (pib:6)
[18 Mar 2009 14:26] Paul DuBois
Noted in 6.0.11 changelog.
[9 May 2009 16:40] Bugs System
Pushed into 5.1.34-ndb-6.2.18 (revid:jonas@mysql.com-20090508185236-p9b3as7qyauybefl) (version source revid:jonas@mysql.com-20090508100057-30ote4xggi4nq14v) (merge vers: 5.1.33-ndb-6.2.18) (pib:6)
[9 May 2009 17:37] Bugs System
Pushed into 5.1.34-ndb-6.3.25 (revid:jonas@mysql.com-20090509063138-1u3q3v09wnn2txyt) (version source revid:jonas@mysql.com-20090508175813-s6yele2z3oh6o99z) (merge vers: 5.1.33-ndb-6.3.25) (pib:6)
[9 May 2009 18:34] Bugs System
Pushed into 5.1.34-ndb-7.0.6 (revid:jonas@mysql.com-20090509154927-im9a7g846c6u1hzc) (version source revid:jonas@mysql.com-20090509073226-09bljakh9eppogec) (merge vers: 5.1.33-ndb-7.0.6) (pib:6)
[5 May 2010 15:04] Bugs System
Pushed into 5.1.47 (revid:joro@sun.com-20100505145753-ivlt4hclbrjy8eye) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[6 May 2010 3:05] Paul DuBois
Push resulted from incorporation of InnoDB tree. No changes pertinent to this bug. Re-closing.
[28 May 2010 6:04] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100524190136-egaq7e8zgkwb9aqi) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (pib:16)
[28 May 2010 6:33] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100524190941-nuudpx60if25wsvx) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[28 May 2010 7:00] Bugs System
Pushed into 5.5.5-m3 (revid:alik@sun.com-20100524185725-c8k5q7v60i5nix3t) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[29 May 2010 2:40] Paul DuBois
Push resulted from incorporation of InnoDB tree. No changes pertinent to this bug.
Re-closing.
[15 Jun 2010 8:09] Bugs System
Pushed into 5.5.5-m3 (revid:alik@sun.com-20100615080459-smuswd9ooeywcxuc) (version source revid:mmakela@bk-internal.mysql.com-20100415070122-1nxji8ym4mao13ao) (merge vers: 5.1.47) (pib:16)
[15 Jun 2010 8:24] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100615080558-cw01bzdqr1bdmmec) (version source revid:mmakela@bk-internal.mysql.com-20100415070122-1nxji8ym4mao13ao) (pib:16)
[17 Jun 2010 11:54] Bugs System
Pushed into 5.1.47-ndb-7.0.16 (revid:martin.skold@mysql.com-20100617114014-bva0dy24yyd67697) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 12:31] Bugs System
Pushed into 5.1.47-ndb-6.2.19 (revid:martin.skold@mysql.com-20100617115448-idrbic6gbki37h1c) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 13:19] Bugs System
Pushed into 5.1.47-ndb-6.3.35 (revid:martin.skold@mysql.com-20100617114611-61aqbb52j752y116) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)