This is occurring for us using Derby 10.6.1.0 in embedded mode, however it's
embedded in daemon process which has a CORBA interface into it, so there can be
multiple processes with multiple threads hitting it, which complicates things a
bit. It seems like we might have a threading issue, but we are having trouble
tracking it down. We actually never saw the problem until some time after we
moved our compiler version from jdk-1.5 to jdk-1.6 (1.6.0_20) however our
runtime has been 1.6.0_14-b08 for a long time. Not sure if that is related
however...
I hoping someone can better explain how derby uses the "tmp/" subdirectory and
could provide some ideas on what might be going on. I haven't been able to
find anything in Jira that looks related.
What we see are spurious errors of the form:
Caused by: java.io.FileNotFoundException:
/build/v3_3_0_97/config/data/tmp/T1283512174014.tmp (No such file or directory)
on SELECT or DELETE statements. The DELETEs are always cascade deletes where
the children tables have CLOB columns, and the SELECTs always contain ORDER BY
clauses - that seems to be the common denominator. Just from browsing the
stack traces it looks like Derby uses the "tmp/" sub-directory to hold pending
results and it's somehow disappearing before it should. It is not reliably
repeatable, even though it's happening a couple times a week in our test suite,
but that is 28,000+ tests across a bunch of processes - so it's not something I
have been able to replicate in a usefully small test case.
I basically don't have a good understanding of what the "tmp/" directory is
used for, or when it's created or goes away. When the error occurs (middle of
night), the next morning I typically don't see a "tmp/" directory at all, so
not only are the "tmp/Tnnnnnnnnn.tmp" files missing, the whole "tmp/" directory
is missing.
Stack trace looks like:
[WARN ] 2010-09-03 07:16:59,428 data.jdbc.JdbcQueryResultExecutor
(JdbcQueryResultExecutor.java:114): Cannot execute query: 'SELECT
o.COORD_OP_CODE, p.PARAMETER_NAME, p.PARAMETER_CODE, o.PARAMETER_VALUE,
o.PARAM_VALUE_FILE_REF, o.UOM_CODE FROM EPSG_COORDOPERATIONPARAMVALUE o INNER
JOIN EPSG_COORDOPERATIONPARAM p ON (o.PARAMETER_CODE = p.PARAMETER_CODE) WHERE
o.COORD_OP_METHOD_CODE = 9807 ORDER BY o.COORD_OP_CODE ASC'. Reason: An
unexpected exception was thrown
java.sql.SQLException: An unexpected exception was thrown
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
Source)
at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown
Source)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(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.ConnectionChild.handleException(Unknown Source)
at
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown
Source)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery(Unknown Source)
at
com.openspirit.plugin.data.jdbc.JdbcQueryResultExecutor.executeQuery(JdbcQueryResultExecutor.java:104)
[...snip...]
Caused by: java.sql.SQLException: An unexpected exception was thrown
at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
Source)
... 21 more
Caused by: java.sql.SQLException: Java exception:
'/build/v3_3_0_97/config/data/tmp/T1283512174014.tmp (No such file or
directory): java.io.FileNotFoundException'.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
Source)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
Source)
at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
Source)
... 18 more
Caused by: java.io.FileNotFoundException:
/build/v3_3_0_97/config/data/tmp/T1283512174014.tmp (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at org.apache.derby.impl.io.DirFile.getOutputStream(Unknown
Source)
at
org.apache.derby.impl.store.raw.data.StreamFileContainer.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.derby.impl.store.raw.data.StreamFileContainer.privGetOutputStream(Unknown
Source)
at
org.apache.derby.impl.store.raw.data.StreamFileContainer.load(Unknown Source)
at
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.addAndLoadStreamContainer(Unknown
Source)
at
org.apache.derby.impl.store.raw.xact.Xact.addAndLoadStreamContainer(Unknown
Source)
at
org.apache.derby.impl.store.access.sort.MergeSort.createMergeRun(Unknown Source)
at
org.apache.derby.impl.store.access.sort.MergeInserter.insert(Unknown Source)
at
org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(Unknown Source)
at
org.apache.derby.impl.sql.execute.SortResultSet.openCore(Unknown Source)
at
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open(Unknown Source)
at
org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
at
org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
... 14 more
------------------ Java Information ------------------
Java Version: 1.6.0_14
Java Vendor: Sun Microsystems Inc.
Java home: /build/v3_3_0_97/jre/Linux_i386_32
Java classpath:
/build/v3_3_0_97/lib/3rdparty/derby.jar:/build/v3_3_0_97/classes:/build/v3_3_0_97/lib/OpenSpirit.jar:/build/v3_3_0_97/lib/OpenSpiritImpl-3.jar:/build/v3_3_0_97/plugins/corba/OspCorba-1.jar:/build/v3_3_0_97/plugins/corba/RemoteDataProvider-2.jar:/build/v3_3_0_97/plugins/corba/RemoteEvent-1.jar:/build/v3_3_0_97/classes/osporg.jar:/build/v3_3_0_97/classes/ospcom.jar:/build/v3_3_0_97/lib/3rdparty/orb.jar:/build/v3_3_0_97/lib/3rdparty/ojdbc14.jar:
OS name: Linux
OS architecture: i386
OS version: 2.6.18-8.el5
Java user name: rgh
Java user home: /users/rgh
Java user dir: /build/v3_3_0_97
java.specification.name: Java Platform API Specification
java.specification.version: 1.6
java.runtime.version: 1.6.0_14-b08
--------- Derby Information --------
JRE - JDBC: Java SE 6 - JDBC 4.0
[/build/v3_3_0_97/lib/3rdparty/derby.jar] 10.6.1.0 - (938214)
Thanks for any help,
Richard Hash
OpenSpirit Corporation