You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gora.apache.org by "Lewis John McGibbney (Commented) (JIRA)" <ji...@apache.org> on 2012/01/20 17:17:39 UTC

[jira] [Commented] (GORA-84) SqlStore not thread-safe because of Closed Statements

    [ https://issues.apache.org/jira/browse/GORA-84?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13189869#comment-13189869 ] 

Lewis John McGibbney commented on GORA-84:
------------------------------------------

Hi Ferdy.

I made upgrades to the sqlbuilder and hsqldb versions in pom.xml [1] this more than likely breaks this part... 

We need to remove the sqlbuilder library anyway and it looks like a move towards JOOQ would be reasonable at this stage, therefore we would be supporting newer versions of both hsqldb and mysql anyway. So looking on the positive side, I think that the gora-sql module needs a bit of a facelift and at least we know what work has to be done.

As you highlight though, I am not sure who is maintaining this store and I for one am certainly not using an RDB daily. I'm sure we would get plenty of help from the JOOQ community to get this rolling though.

Thoughts?

[1] http://svn.apache.org/viewvc/incubator/gora/trunk/pom.xml?r1=1187751&r2=1205346&diff_format=h
                
> SqlStore not thread-safe because of Closed Statements
> -----------------------------------------------------
>
>                 Key: GORA-84
>                 URL: https://issues.apache.org/jira/browse/GORA-84
>             Project: Gora
>          Issue Type: Bug
>          Components: storage-sql
>            Reporter: Ferdy Galema
>
> 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").

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira