[Sqlrelay-discussion] Complex Queries Cause Mysql Connection to segfault
Brought to you by:
mused
|
From: Chris C. <cc...@gm...> - 2007-03-19 23:11:36
|
I've run into a some situations where complex queries in a certain
sequence cause the connection handler to segfault which results in a
cursor error from the listener.
Mysql Version: mysql-5.0.x-max
SQLRelay Version: 0.38 - 0.39 (from cvs) (++ autoreconnect patch)
Pertinent mysql settings: "wait_timeout = 10"
sql to generate table schema from mysqldump (sans comments):
DROP TABLE IF EXISTS `sqlrelay`;
CREATE TABLE `sqlrelay` (
`var1` varchar(25) default NULL,
`var2` varchar(25) default NULL,
`var3` varchar(25) default NULL,
`var4` varchar(25) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `sqlrelay` WRITE;
INSERT INTO `sqlrelay` VALUES
('one','two','three','four'),('one','two','three','four'),('one','two','three','four');
UNLOCK TABLES;
testsql.sql
----
SELECT var1, var2, var3, COALESCE(var4,'whatever') as var4 FROM
test_sqlrelay.sqlrelay ORDER BY var1 ASC LIMIT 0,70;
select count(*) as numResults from test_sqlrelay.sqlrelay limit 10;
testsql.sh
----
#!/bin/sh
for I in `seq 10`; do
/usr/local/sqlrelay/bin/sqlrsh -id <mysql> testsql.sql
echo -e "[ $I ]\n"
sleep 10
done
Running this script with that sql on a freshly started sqlrelay
instance (it seems to vary otherwise) will result in a segfault and
cursor error on the second pass.
In gdb I was able to track it down to:
-- mysqlconnection.C:437 --
if ((queryresult=mysql_stmt_execute(stmt))) {
Now here's where it gets weird. If you do reverse the statements in
testsql.sql (do the select count() first) then this error does NOT
occur.
There are other examples where I've found this behavior, but they're
far more sporadic.
I'll continue to try to track this further on my end, but if you need
any further details, please let me know.
Thanks for your time,
- Chris
|