Bug #5818 segfault using @variable
Submitted: 30 Sep 2004 2:32 Modified: 7 Nov 2004 20:08
Reporter: Justin Swanhart Email Updates:
Status: No Feedback Impact on me:
Category:MySQL Server Severity:S1 (Critical)
Version: mysql-4.1.4-gamma (Source distribution) OS:Linux (RHAS 3 ( 2.4.21-15.0.4.ELsmp ))
Assigned to: CPU Architecture:Any

[30 Sep 2004 2:32] Justin Swanhart
My server segfaults when I execute a block of JDBC code that contains a @variable.  I'm not sure if the code in question would actually work they way it was intended to anyway, but regardless the server shouldn't crash.

This is the resolved stack trace.  It is the same each time the server crashes.
0x816c290 handle_segfault + 480
0xb7575d66 _end + -1358938154
0x81cb1ad _ZN9MYSQL_LOG5writeEP9Log_event + 1357
0x81c57f8 _Z12mysql_deleteP3THDP13st_table_listP4ItemP11st_sql_listmm + 1608
0x8182493 _Z21mysql_execute_commandP3THD + 4707
0x81c0f3e _Z12execute_stmtP3THDP18Prepared_statementP6Stringb + 78
0x81bf7d0 _Z18mysql_stmt_executeP3THDPcj + 304
0x8180f46 _Z16dispatch_command19enum_server_commandP3THDPcj + 5078
0x817fb16 _Z10do_commandP3THD + 134
0x817f2c8 handle_one_connection + 920
0xb7570e21 _end + -1358958447
0xb74aa08a _end + -1359772934

New value of fp=(nil) failed sanity check, terminating stack trace!

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x8645bc8 = delete from easynews.webdata where group_id = 32001 and postdate < @lastday

How to repeat:
Executing the following jdbc code causes the server to segfault:
private void purgeDays() throws SQLException{
  //System.out.println("Purging old rows for " + groupID);
  setExtendedStatus ("purging rows");
  stmt.execute("set @lastday = (select day from last_day)");
  final String sql = "delete from easynews.webdata where group_id = ? and postdate < @lastday";
  java.sql.PreparedStatement pstmt = conn.prepareStatement (sql);
  pstmt.setInt(1, groupID);
  pstmt = null;
[30 Sep 2004 2:36] Justin Swanhart
updated synopsis
[7 Oct 2004 12:05] MySQL Verification Team
Could you please provide us a repeatable test case with the tables's schema
and your script. You can download at:


making referenceto this bug report.

[7 Oct 2004 20:08] Justin Swanhart
the zip file bug.5818.zip has been uploaded to 

Included is a sql script to create the schema, a java source file, a java class file and the MySQL Java Connector version that I am using.
[14 Feb 2005 22:54] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".