Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
None
-
None
-
None
Description
In some multithreaded test code (actually Nutchgora TestGoraStorage) the current trunk of Gora SqlStore fails because of Closed Statements:
Caused by: java.sql.SQLException: statement is closed
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCPreparedStatement.executeBatch(Unknown Source)
at org.apache.gora.sql.store.SqlStore.flush(SqlStore.java:329)
... 9 more
Caused by: org.hsqldb.HsqlException: statement is closed
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.Session.executeCompiledBatchStatement(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
... 11 more
I am not sure why this problem suddenly arises as I could not find relevant changes in the SqlStore related code.
The problem is caused of incorrectly synchronized code when buffering and flushing put requests. Some statements are accidently shared between threads because of the shared write buffer (the HashSet writeCache). So it may happen that some closed statements are trying to be executed, raising the above exception. When I disabled SqlUtils.close() by making the method empty, the tests worked again. So that is the lazy man's solution: Disable the writeCache.
I suggest that somebody who is more into maintaining this store fixes it user a better solution (proper synchronization). When there is no interest in doing so, I can still always implement the lazy man's solution
By the way, the fact that this error was not detected in Gora's own tests suggests that we might want to expand it's coverage. This is in line what was already mentioned a few days ago on the dev list ("inconsistencies in TestXXXStore").
Attachments
Attachments
Issue Links
- depends upon
-
GORA-86 Support JOOQ API within gora-sql module
- Open
- is depended upon by
-
NUTCH-1205 Upgrade gora modules to 0.2 in ivy/ivy.xml
- Closed