[opencms-dev] CmsDbSqlException

Claus Priisholm cpr at codedroids.com
Thu Jun 10 10:01:15 CEST 2010


I am using a different test SQL statement, but it should no matter as 
long as the connection gets tested.

I am not sure about the cause "Lock wait timeout exceeded; try 
restarting transaction" - this would suggest that something is messed up 
in relation to a transaction - perhaps a connection with an unfinished 
transaction has been returned to the pool. But in a default installation 
on MySQL there is not much going on as far as transactions goes, The 
MyISAM backend considers a single statement as a transaction (kind of 
having autocommit on all the time) so maybe in case of a freaky timing 
issue or likewise you could run into to it, but I would not think it 
would be easy to reproduce.

The Prepared Statemnt looks a bit weird as well "DELEM" is not a valid 
SQL command as far as I know, but it could just be your cut'n'pase that 
caused it.

/Claus



Konstantin Ott wrote:
> these params were set:
> db.pool.default.testOnBorrow=true
> db.pool.default.testQuery=/* ping */ SELECT 1
> 
> and I've got another CmsDbSqlException:
> 
> Caused by: org.opencms.db.CmsDbSqlException: An SQL error occurred when 
> executing the following query: 
> com.mysql.jdbc.PreparedStatement at 45bc00e4: DELEM CMS_ONLINE_PROPERTIES 
> WHERE (PROPERTY_MAPPING_ID='be622085-3d89-11df-af26-68bdd7447ccc' AND 
> PROPERTY_MAPPING_TYPE=2) OR 
> (PROPERTY_MAPPING_ID='be62209-11df-af26-68bdd7447ccc' AND 
> PROPERTY_MAPPING_TYPE=1).
>          at 
> org.opencms.db.generic.CmsVfsDriver.deletePropertyObjects(CmsVfsDriver.java:939) 
> 
>          at 
> org.opencms.ocee.cache.CmsVfsCache.deletePropertyObjects(CmsVfsCache.java:247) 
> 
>          at 
> org.opencms.db.generic.CmsProjectDriver.publishChangedFile(CmsProjectDriver.java:2717) 
> 
>          at 
> org.opencms.db.generic.CmsProjectDriver.publishFile(CmsProjectDriver.java:964) 
> 
>          ... 5 more
> Caused by: java.sql.SQLException: Lock wait timeout exceeded; try 
> restarting transaction
>          at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
>          at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
>          at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
>          at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
>          at com.mysql.jdbc.Connection.execSQL(Connection.java:3256)
>          at 
> com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1313) 
> 
>          at 
> com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1585)
>          at 
> com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1500)
>          at 
> com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1485)
>          at 
> org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102) 
> 
>          at 
> org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102) 
> 
>          at 
> org.opencms.db.generic.CmsVfsDriver.deletePropertyObjects(CmsVfsDriver.java:937) 
> 
> 
> 
> 
> Am 09.06.2010 09:55, schrieb Claus Priisholm:
>> I am not sure where the problem occurs, but when upgrading involved
>> products to fairly new ones (like MySQL 5.1, Java 6 and  OpenCms 7.x) I
>> find it necessary to enable testOnBorrow and the related testQuery in
>> opencms.properties to avoid unexpected problems.
>>
>> Konstantin Ott wrote:
>>    
>>> Hello list,
>>>
>>> since a few days we find in the opencms log file SQL Exceptions. It
>>> seems to happen when publishing a file.
>>> It is not reproducable and the SELECT is ok. There is a lot of load on
>>> the system and there is a lot of changing content. But the problem only
>>> appeared 2 times last week.
>>> OpenCMS seems to loose a connection every now and then. Some time ago we
>>> switched the system from Suse-Mysql5.0.51 to Debian-Mysql 5.1.45.
>>> I don't know if its the reason.
>>> Has anybody got an idea?
>>>
>>> greetings
>>> Konstantin Ott
>>>
>>>
>>>
>>>
>>>
>>> org.opencms.db.CmsDbSqlException: An SQL error occurred when executing
>>> the following query: com.mysql.jdbc.PreparedStatement at f22345d: SELECT
>>> CMS_OFFLINE_CONTENTS.FILE_CONTENT FROM CMS_OFFLINE_CONTENTS WHERE
>>> CMS_OFFLINE_CONTENTS.RESOURCE_ID='99a69fba-bd41-11dc-9d14-69bdd7447ccc'.
>>>           at
>>> org.opencms.db.generic.CmsVfsDriver.readContent(CmsVfsDriver.java:1468)
>>>           at
>>> org.opencms.ocee.cache.CmsVfsCache.readContent(CmsVfsCache.java:469)
>>>           at
>>> org.opencms.db.generic.CmsProjectDriver.publishFileContent(CmsProjectDriver.java:1068)
>>>           at
>>> org.opencms.ocee.cache.CmsProjectCache.publishFileContent(CmsProjectCache.java:385)
>>>           at
>>> org.opencms.db.generic.CmsProjectDriver.publishChangedFile(CmsProjectDriver.java:2760)
>>>           at
>>> org.opencms.db.generic.CmsProjectDriver.publishFile(CmsProjectDriver.java:964)
>>>           at
>>> org.opencms.ocee.cache.CmsProjectCache.publishFile(CmsProjectCache.java:361)
>>>           at
>>> org.opencms.db.generic.CmsProjectDriver.publishProject(CmsProjectDriver.java:1455)
>>>           at
>>> org.opencms.ocee.cache.CmsProjectCache.publishProject(CmsProjectCache.java:421)
>>>           at
>>> org.opencms.db.CmsDriverManager.publishJob(CmsDriverManager.java:5221)
>>>           at
>>> org.opencms.publish.CmsPublishThread.run(CmsPublishThread.java:199)
>>> Caused by: com.mysql.jdbc.CommunicationsException: Communications link
>>> failure due to underlying exception:
>>>
>>> ** BEGIN NESTED EXCEPTION **
>>>
>>> java.lang.ArrayIndexOutOfBoundsException
>>>
>>> STACKTRACE:
>>>
>>> java.lang.ArrayIndexOutOfBoundsException
>>>           at java.lang.System.arraycopy(Native Method)
>>>           at
>>> com.mysql.jdbc.CompressedInputStream.read(CompressedInputStream.java:281)
>>>           at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1994)
>>>           at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2464)
>>>           at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2916)
>>>           at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:885)
>>>           at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1360)
>>>           at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:2358)
>>>           at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:451)
>>>           at
>>> com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:2076)
>>>           at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1451)
>>>           at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1787)
>>>           at com.mysql.jdbc.Connection.execSQL(Connection.java:3256)
>>>           at
>>> com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1313)
>>>           at
>>> com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1448)
>>>           at
>>> org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
>>>           at
>>> org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
>>>           at
>>> org.opencms.db.generic.CmsVfsDriver.readContent(CmsVfsDriver.java:1453)
>>>           at
>>> org.opencms.ocee.cache.CmsVfsCache.readContent(CmsVfsCache.java:469)
>>>           at
>>> org.opencms.db.generic.CmsProjectDriver.publishFileContent(CmsProjectDriver.java:1068)
>>>           at
>>> org.opencms.ocee.cache.CmsProjectCache.publishFileContent(CmsProjectCache.java:385)
>>>           at
>>> org.opencms.db.generic.CmsProjectDriver.publishChangedFile(CmsProjectDriver.java:2760)
>>>           at
>>> org.opencms.db.generic.CmsProjectDriver.publishFile(CmsProjectDriver.java:964)
>>>           at
>>> org.opencms.ocee.cache.CmsProjectCache.publishFile(CmsProjectCache.java:361)
>>>           at
>>> org.opencms.db.generic.CmsProjectDriver.publishProject(CmsProjectDriver.java:1455)
>>>           at
>>> org.opencms.ocee.cache.CmsProjectCache.publishProject(CmsProjectCache.java:421)
>>>           at
>>> org.opencms.db.CmsDriverManager.publishJob(CmsDriverManager.java:5221)
>>>           at
>>> org.opencms.publish.CmsPublishThread.run(CmsPublishThread.java:199)
>>>
>>>
>>> ** END NESTED EXCEPTION **
>>>
>>>
>>>
>>> Last packet sent to the server was 2 ms ago.
>>>           at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2922)
>>>           at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:885)
>>>           at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1360)
>>>           at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:2358)
>>>           at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:451)
>>>           at
>>> com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:2076)
>>>           at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1451)
>>>           at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1787)
>>>           at com.mysql.jdbc.Connection.execSQL(Connection.java:3256)
>>>           at
>>> com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1313)
>>>           at
>>> com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1448)
>>>           at
>>> org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
>>>           at
>>> org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
>>>           at
>>> org.opencms.db.generic.CmsVfsDriver.readContent(CmsVfsDriver.java:1453)
>>>
>>>      
>>    
> 
> 

-- 
Claus Priisholm, CodeDroids ApS
Phone: +45 48 22 46 46
cpr (you know what) codedroids.com - http://www.codedroids.com
cpr (you know what) interlet.dk - http://www.interlet.dk
-- 
Javadocs and other OpenCms stuff: 
http://www.codedroids.com/community/opencms



More information about the opencms-dev mailing list