Bug #11172 mysql_stmt_attr_set CURSOR_TYPE_READ_ONLY date/datetime filter server crash
Submitted: 8 Jun 2005 14:45 Modified: 5 Jul 2005 8:50
Reporter: Berto van de Kraats Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.6-beta-nightly-20050515-debug OS:Linux (linux)
Assigned to: Konstantin Osipov CPU Architecture:Any

[8 Jun 2005 14:45] Berto van de Kraats
Description:
If cursors are enabled, a query with a filter on a date or datetime column will cause a crash of the server after the data has been fetched.

How to repeat:
Compile and run the attached program (which is an automatically generated trace of our mysql database driver). The problem reproduces if the program silently runs and has exit status 0.
The trace contains a call to mysql_stmt_execute that returns 1 because the server crashed (search for pattern "ERROR:" in attached program).
[8 Jun 2005 14:47] Berto van de Kraats
Cpp trace of problem

Attachment: bug11172.cpp (text/plain), 24.80 KiB.

[15 Jun 2005 10:01] Aleksey Kishkin
tested on 5.0.6 beta and got:
Version: '5.0.6-beta-standard-log'  socket: '/tmp/mysql.sock'  port: 3306  MySQL Community Edition - Standard (GPL)
pure virtual method called
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=16777216
read_buffer_size=258048
max_used_connections=1
max_connections=100
threads_connected=1
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 92783 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd=0x89d3ef8
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=0xbfe7e718, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x8099672
0x83409c8
0x834c0a1
0x8340d59
0x834c4c0
0x83b1038
0x83b105d
0x83b0a3b
0x80517d3
0x8064db0
0x8064f9d
0x805bd1b
0x80cecfd
0x80d41d4
0x80d7788
0x80d3f8f
0x80aa4e9
0x80f3f6f
0x80a8aa1
0x80a84f3
0x80a7ac4
0x833e17c
0x8367b8a
New value of fp=(nil) 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 0x89fea50 = SELECT a0.t_empno,a0.t_hiredate FROM baan.tdbtst120000 a0  WHERE a0.t_hiredate = ?
thd->thread_id=2
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.

stack trace is:

0x8099672 handle_segfault + 430
0x83409c8 pthread_sighandler + 184
0x834c0a1 kill + 17
0x8340d59 raise + 25
0x834c4c0 abort + 192
0x83b1038 __default_terminate + 24
0x83b105d __terminate + 29
0x83b0a3b __pure_virtual + 43
0x80517d3 save_in_field__4ItemP5Fieldb + 131
0x8064db0 convert_constant_item__FP3THDP5FieldPP4Item + 64
0x8064f9d fix_length_and_dec__15Item_bool_func2 + 329
0x805bd1b fix_fields__9Item_funcP3THDP13st_table_listPP4Item + 327
0x80cecfd setup_conds__FP3THDP13st_table_listT1PP4Item + 169
0x80d41d4 prepare__4JOINPPP4ItemP13st_table_listUiP4ItemUiP8st_orderT6T4T6P13st_select_lexP18st_select_lex_unit + 492
0x80d7788 mysql_select__FP3THDPPP4ItemP13st_table_listUiRt4List1Z4ItemP4ItemUiP8st_orderT7T5T7UlP13select_resultP18st_select_lex_unitP13s + 696
0x80d3f8f handle_select__FP3THDP6st_lexP13select_resultUl + 191
0x80aa4e9 mysql_execute_command__FP3THD + 1269
0x80f3f6f mysql_stmt_execute__FP3THDPcUi + 763
0x80a8aa1 dispatch_command__F19enum_server_commandP3THDPcUi + 1441
0x80a84f3 do_command__FP3THD + 203
0x80a7ac4 handle_one_connection + 748
0x833e17c pthread_start_thread + 220
0x8367b8a thread_start + 4
[1 Jul 2005 11:48] 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/internals/26588
[1 Jul 2005 12:02] Konstantin Osipov
Approved on IRC.
[1 Jul 2005 12:29] Konstantin Osipov
Fixed in 5.0 tree, currently tagged 5.0.9
[5 Jul 2005 8:50] Jon Stephens
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:

Documented in 5.0.9 changelog; closed.