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

Jim Newsham commented on DERBY-5237:
------------------------------------

One more comment.  Instead of just looking at the outer SQLException for sql 
state "08000", I actually probe the entire exception chain in case it was 
buried below the surface -- but there is no sql state "08000" anywhere in the 
exception chain.

Here is the stack trace for the failed unit test:

java.sql.SQLException: Exception during creation of file 
C:\Users\jnewsham.REFERENTIA\AppData\Local\Temp\bbjfgvlvpyps\db\seg0\c490.dat 
for container
  at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:98)
  at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
  at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:278)
  at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
  at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:348)
  at 
org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2290)
  at 
org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:82)
  at 
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1334)
  at 
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1686)
  at 
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:308)
  at 
com.referentia.commons.samplebase.derby.DerbyInterruptTest.createTable(DerbyInterruptTest.java:169)
  at 
com.referentia.commons.samplebase.derby.DerbyInterruptTest.access$2(DerbyInterruptTest.java:159)
  at 
com.referentia.commons.samplebase.derby.DerbyInterruptTest$3$1.perform(DerbyInterruptTest.java:149)
  at 
com.referentia.commons.samplebase.derby.DerbyInterruptTest$3$1.perform(DerbyInterruptTest.java:1)
  at 
com.referentia.commons.samplebase.derby.DerbyInterruptTest.perform(DerbyInterruptTest.java:324)
  at 
com.referentia.commons.samplebase.derby.DerbyInterruptTest.access$1(DerbyInterruptTest.java:313)
  at 
com.referentia.commons.samplebase.derby.DerbyInterruptTest$3.call(DerbyInterruptTest.java:146)
  at 
com.referentia.commons.samplebase.derby.DerbyInterruptTest$3.call(DerbyInterruptTest.java:1)
  at 
com.referentia.commons.samplebase.derby.DerbyInterruptTest$4.run(DerbyInterruptTest.java:196)
  at java.lang.Thread.run(Thread.java:662)
Caused by: java.sql.SQLException: Exception during creation of file 
C:\Users\jnewsham.REFERENTIA\AppData\Local\Temp\bbjfgvlvpyps\db\seg0\c490.dat 
for container
  at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
  at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:122)
  at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)
  ... 19 more
Caused by: java.sql.SQLException: Java exception: ': 
java.nio.channels.ClosedByInterruptException'.
  at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
  at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:122)
  at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)
  at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
  at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
  at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:408)
  ... 17 more
Caused by: java.nio.channels.ClosedByInterruptException
  at 
java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
  at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:643)
  at 
org.apache.derby.impl.store.raw.data.RAFContainer4.writeFull(RAFContainer4.java:1182)
  at 
org.apache.derby.impl.store.raw.data.RAFContainer4.writeAtOffset(RAFContainer4.java:1094)
  at 
org.apache.derby.impl.store.raw.data.FileContainer.writeHeader(FileContainer.java:924)
  at 
org.apache.derby.impl.store.raw.data.RAFContainer.writeRAFHeader(RAFContainer.java:703)
  at 
org.apache.derby.impl.store.raw.data.RAFContainer.run(RAFContainer.java:1383)
  at java.security.AccessController.doPrivileged(Native Method)
  at 
org.apache.derby.impl.store.raw.data.RAFContainer.createContainer(RAFContainer.java:813)
  at 
org.apache.derby.impl.store.raw.data.RAFContainer4.createContainer(RAFContainer4.java:202)
  at 
org.apache.derby.impl.store.raw.data.FileContainer.createIdent(FileContainer.java:473)
  at 
org.apache.derby.impl.store.raw.data.FileContainer.createIdentity(FileContainer.java:409)
  at 
org.apache.derby.impl.services.cache.ConcurrentCache.create(ConcurrentCache.java:388)
  at 
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.addContainer(BaseDataFileFactory.java:842)
  at org.apache.derby.impl.store.raw.xact.Xact.addContainer(Xact.java:1362)
  at org.apache.derby.impl.store.access.heap.Heap.create(Heap.java:274)
  at 
org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(HeapConglomerateFactory.java:206)
  at 
org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(RAMTransaction.java:823)
  at 
org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(CreateTableConstantAction.java:201)
  at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:61)
  at 
org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
  at 
org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
  at 
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1242)
  ... 12 more



> interrupting thread performing "create table" doesn't cause SQLException with 
> sql state "08000"
> -----------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5237
>                 URL: https://issues.apache.org/jira/browse/DERBY-5237
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.8.1.2
>         Environment: Windows 7, JDK 1.6.0_25
>            Reporter: Jim Newsham
>         Attachments: DerbyInterruptTest.java
>
>
> We would like to take advantage of the recent Derby enhancement for handling 
> thread interruption.  
> http://db.apache.org/derby/docs/dev/devguide/devguide-single.html, section 
> "Working with database threads in an embedded environment" states that in the 
> case of exception, the calling code should receive a SQLException with code 
> 08000.  In my testing, this appears to work for sql "insert" statements, but 
> not for sql "create table" statements.  This is an issue for us since 
> database tables are created dynamically over the course of the application's 
> normal operation.
> Junit test repro to follow.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to