MessageCleanup fails with mysql 4.1.x ------------------------------------- Key: AMQ-678 URL: https://issues.apache.org/activemq/browse/AMQ-678 Project: ActiveMQ Type: Bug Components: Message Store Versions: 4.0 M4 Reporter: Paul Focke Priority: Minor When ActiveMQ does a message cleanup using mysql-4.1 for jdbc persistence an error occurs. ActiveMQ complains that the connection is already closed. The nested exception however is an EOFException. The exception is thrown by DefaultJDBCAdapter.doDeleteOldMessages(DefaultJDBCAdapter.java:544). I poked around I found that the sql statement it produces causes mysql to crash. It even causes mysqld to crash when entered in the mysql client console, so this is not a Connector/J issue. Here is the statement DELETE FROM ACTIVEMQ_MSGS WHERE ( EXPIRATION<>0 AND EXPIRATION<1144326387433) OR ID <= ( SELECT min(ACTIVEMQ_ACKS.LAST_ACKED_ID) FROM ACTIVEMQ_ACKS WHERE ACTIVEMQ_ACKS.CONTAINER=ACTIVEMQ_MSGS.CONTAINER) It can be found in Statements.java:220. I have tested this under mysql 4.1.12, 4.1.13 & 5.0.18. The exceptions were only thrown in mysql 4.1. 5.0 behaved as would be expected. Possible solutions would be : - rewrite the delete statement so that it doesn't kill mysqld : - I had a quick look into rewriting the statement but I haven't found how - change the current delete into a select id from ... (this works) and delete records 1 by 1 using the resultSet ( which really sucks when there are lots of messages to be deleted ) - not use mysql-4.1 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira