[ 
https://issues.apache.org/jira/browse/DERBY-4640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12864261#action_12864261
 ] 

Kristian Waagan commented on DERBY-4640:
----------------------------------------

Hi Ibrahim,

Thanks for the report.

I think the issue making things more complicated, is that Derby may be 
interrupted while writing data to disk. Before NIO, I don't think this was 
possible - the ongoing IO operation was allowed to finish.
So we can't simply catch and log the exception, we also have to make sure the 
data on disk is consistent.

The fact that FutureTask.cancel(boolean)  may use Thread.interrupt() to cancel 
running tasks is bad news for embedded Derby, and I think it would be 
beneficial if the community managed to deal with this issue sooner than later. 
Fortunately the error reporting was improved a while ago, such that it is 
easier to detect this situation.

Regarding the code snippet, maybe it would be more appropriate to do this in 
Derby (where IO isn't a concern)?
while (condition) {
    try {
          Object.wait();
    } catch (InterruptedException e) {
        log e;
        // Restore the interrupted status
        Thread.currentThread().interrupt();
    }
} 

> Intermittent "Connection closed by unknown interrupt." errors
> -------------------------------------------------------------
>
>                 Key: DERBY-4640
>                 URL: https://issues.apache.org/jira/browse/DERBY-4640
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.5.3.0
>         Environment: Java version: 1.6.0_18
> Embedded Derby: 1.5.3.0
>            Reporter: Ibrahim Hasbini
>            Priority: Critical
>             Fix For: 10.5.3.0
>
>
> An intermittent InterruptedException causes certain queries to fail (an sql 
> delete in this case).
> derby.log output:
> 2010-05-03 11:29:29.400 GMT Thread[GC.EndPointInfo Runnable Thread - 
> xyz.middleware.remoting.connection.gc$endpointinf...@1cf3127,5,main] (XID = 
> 1089), (SESSIONID = 3), (DATABASE = 
> .xyz/middleware/registry/middleware.registry/db), (DRDAID = null), Failed 
> Statement is: null with 1 parameters begin parameter #1: 227 :end parameter 
> ERROR 08000: Connection closed by unknown interrupt.
>       at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>       at org.apache.derby.iapi.error.StandardException.interrupt(Unknown 
> Source)
>       at org.apache.derby.impl.store.raw.log.LogToFile.flush(Unknown Source)
>       at org.apache.derby.impl.store.raw.log.LogToFile.flush(Unknown Source)
>       at org.apache.derby.impl.store.raw.log.FileLogger.flush(Unknown Source)
>       at org.apache.derby.impl.store.raw.xact.Xact.prepareCommit(Unknown 
> Source)
>       at org.apache.derby.impl.store.raw.xact.Xact.commit(Unknown Source)
>       at org.apache.derby.impl.store.raw.xact.Xact.commit(Unknown Source)
>       at org.apache.derby.impl.store.access.RAMTransaction.commit(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.doCommit(Unknown
>  Source)
>       at 
> org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.userCommit(Unknown
>  Source)
>       at org.apache.derby.impl.jdbc.TransactionResourceImpl.commit(Unknown 
> Source)
>       at org.apache.derby.impl.jdbc.EmbedConnection.commit(Unknown Source)
>       at 
> org.apache.commons.dbcp.DelegatingConnection.commit(DelegatingConnection.java:334)
>       at 
> org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.commit(PoolingDataSource.java:211)
> (...)
> Caused by: java.lang.InterruptedException
>       at java.lang.Object.wait(Native Method)
>       at java.lang.Object.wait(Object.java:485)
>       at org.apache.derby.impl.store.raw.log.LogToFile.flush(Unknown Source)
>       at org.apache.derby.impl.store.raw.log.LogToFile.flush(Unknown Source)
>       at org.apache.derby.impl.store.raw.log.FileLogger.flush(Unknown Source)
>       at org.apache.derby.impl.store.raw.xact.Xact.prepareCommit(Unknown 
> Source)
>       at org.apache.derby.impl.store.raw.xact.Xact.commit(Unknown Source)
>       at org.apache.derby.impl.store.raw.xact.Xact.commit(Unknown Source)
>       at org.apache.derby.impl.store.access.RAMTransaction.commit(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.doCommit(Unknown
>  Source)
>       at 
> org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.userCommit(Unknown
>  Source)
>       at org.apache.derby.impl.jdbc.TransactionResourceImpl.commit(Unknown 
> Source)
>       at org.apache.derby.impl.jdbc.EmbedConnection.commit(Unknown Source)
>       at 
> org.apache.commons.dbcp.DelegatingConnection.commit(DelegatingConnection.java:334)
>       at 
> org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.commit(PoolingDataSource.java:211)
> followed by:
> ------------  BEGIN SHUTDOWN ERROR STACK -------------
> ERROR XSTB0: An exception was thrown during transaction abort.
>       at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>       at org.apache.derby.impl.store.raw.xact.Xact.preComplete(Unknown Source)
>       at org.apache.derby.impl.store.raw.xact.Xact.abort(Unknown Source)
>       at 
> org.apache.derby.impl.store.raw.xact.XactContext.cleanupOnError(Unknown 
> Source)
>       at 
> org.apache.derby.iapi.services.context.ContextManager.cleanupOnError(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.cleanupOnError(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>       at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>       at org.apache.derby.impl.jdbc.EmbedConnection.commit(Unknown Source)
>       at 
> org.apache.commons.dbcp.DelegatingConnection.commit(DelegatingConnection.java:334)
>       at 
> org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.commit(PoolingDataSource.java:211)
> (...)
> ------------  END SHUTDOWN ERROR STACK -------------

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to