Bug #5487 Server Crash in Conjunction with Connector/J
Submitted: 9 Sep 2004 4:51 Modified: 19 Oct 2004 16:29
Reporter: Robert Nice Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:Gamma 4.1.4 / Conn-J 3.1.4 OS:Linux (Linux (Redhat 7.3))
Assigned to: Konstantin Osipov CPU Architecture:Any

[9 Sep 2004 4:51] Robert Nice
Description:
Lots of crashes when using Connector/J 3.1.4. 3.0.14 works fine.

040909  0:28:42  [ERROR] Warning: Asked for 196608 thread stack, but got 126976
040909  0:28:42  InnoDB: Started; log sequence number 0 2505657006
/usr/local/mysql/bin/mysqld: ready for connections.
Version: '4.1.4-gamma-standard'  socket: '/tmp/mysql.sock'  port: 3306  Official MySQL-standard binary

mysqld got signal 11;
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=402653184
read_buffer_size=2093056
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 = 802415 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd=0x8629708
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=0xbfe7ed18, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x808a183 handle_segfault + 423
0x82d3cb8 pthread_sighandler + 184
0x8054de4 fix_fields__9Item_funcP3THDP13st_table_listPP4Item + 156
0x805f4ef fix_fields__9Item_condP3THDP13st_table_listPP4Item + 347
0x80b4fc6 setup_conds__FP3THDP13st_table_listPP4Item + 126
0x80b8cab prepare__4JOINPPP4ItemP13st_table_listUiP4ItemUiP8st_orderT6T4T6P13st_select_lexP18st_select_lex_unit + 387
0x80bba37 mysql_select__FP3THDPPP4ItemP13st_table_listUiRt4List1Z4ItemP4ItemUiP8st_orderT7T5T7UlP13select_resultP18st_select_lex_unitP13s + 719
0x80b8ae6 handle_select__FP3THDP6st_lexP13select_result + 150
0x80991dd mysql_execute_command__FP3THD + 1241
0x80d1d94 execute_stmt__FP3THDP18Prepared_statementP6Stringb + 160
0x80d1b6a mysql_stmt_execute__FP3THDPcUi + 234
0x8097d76 dispatch_command__F19enum_server_commandP3THDPcUi + 1426
0x80977d8 do_command__FP3THD + 188
0x8096f17 handle_one_connection + 615
0x82d146c pthread_start_thread + 220
0x82fa9fa thread_start + 4
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://www.mysql.com/doc/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 0x8646cf8 = SELECT COUNT(PU.PurchaseID), SUM(PU.RebillValue) FROM Purchases AS PU, Websites AS WB WHERE PU.WebsiteID = WB.WebsiteID AND PU.FlagRecurring = 1 AND PU.CancelTime = 0 AND PU.NextRebill BETWEEN NOW() AND ADDDATE(?, INTERVAL 1 MONTH) AND ( ClientID = 1 )
thd->thread_id=1
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
040909 00:28:52  mysqld restarted

Default my-huge.cnf with the following changes:
innodb_data_home_dir = /usr/local/mysql/data/
innodb_data_file_path = ibdata1:100M;ibdata2:100M;ibdata3:100M;ibdata4:100M;ibreserve:10M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/data/
innodb_log_arch_dir = /usr/local/mysql/data/
innodb_buffer_pool_size = 384M
innodb_additional_mem_pool_size = 20M
innodb_log_file_size = 8M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

This is a dual P3 system with 4GB RAM. I can prepare table schemas if you require, although the same query run from the console works just fine.

The ? parameter in the query is a java.util.Date object for 2004-09-01 00:00:00
It's set with something horrible like this:
s.setTimestamp(i+1, new java.sql.Timestamp( ((java.util.Date)fields[i]).getTime() ));

The same Date object is used okay in other SQL before it in the program.

How to repeat:
Good luck!

Suggested fix:
Stick with Connector/J stable.
[17 Sep 2004 20:37] Konstantin Osipov
Thank you for your bug report. This issue has already been fixed
in the latest released version of that product, which you can download at 
http://www.mysql.com/downloads/
[17 Sep 2004 20:40] Konstantin Osipov
Oops, sorry for confusion, just clicked a wrong ling gave so devastating results.
Please ignore my previous reply.
But we were indeed fixing the server in respect to handling zero dates.
Could you check if this behaviour can be reproduced against the latest server (development snapshot)?
For the development team to verify your bug, we need a repeatable test case.
Thank you.
[21 Sep 2004 18:44] Robert Nice
Do you mean 4.1.5, or 5.x ???
[22 Sep 2004 6:57] Konstantin Osipov
4.1.5
5.0 will be fixed as soon as we finish with 4.1 -> 5.0 merge.
[19 Oct 2004 16:29] Konstantin Osipov
This bug is very likely fixed in the latest development snapshot.
No feedback was provided if it's still repeatable, and as there is no repeatable test
case attached, we can't verify the bug ourselves.
I'm closing the bug by now, please feel free to reopen it if you have additional info.