You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Daniel Noll <da...@nuix.com> on 2008/06/06 03:19:57 UTC
ShutdownException when I haven't asked the database to shut down
Hi all.
I'm getting a load of errors like this. They seem to happen at random times;
sometimes I see it when creating a statement, sometimes when executing,
sometimes when iterating over a result set. Once I even had it happen when
creating the connection itself, which is hard to believe.
Caused by: java.sql.SQLException: Java exception: ': org.apache.derby.iapi.error.ShutdownException'.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2125)
at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1325)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1652)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery(EmbedPreparedStatement.java:277)
We are indeed calling shutdown later, but I've checked the time at which
things happen and we don't start to shutdown until after this exception.
But this is coming from unit tests, and the database for each test is
being created into the same directory. If I run the failing test by
itself I can't seem to reproduce the problem, but running after other
tests it fails around 50% of the time.
Is it possible a shutdown() for a previous database at the same location
is somehow causing issues for a future database created there?
If this is the case, is there some way to *know* when the database
shutdown has actually occurred?
Daniel
Re: ShutdownException when I haven't asked the database to shut down
Posted by "Dag H. Wanvik" <Da...@Sun.COM>.
Daniel Noll <da...@nuix.com> writes:
> What If I put a container around Derby and force all queries through that,
> blocking queries which occur after shutdown has started, it does appear to
> fix the issue.
>
> My theory is that some event was being fired on another thread and then that
> resulted in a query which occurred at the same time as shutdown. Derby
> mustn't handle this situation by denying that query or terminating it, but
> what ends up happening is the shutdown continues and completes some random
> time *after* the call to getConnection("...shutdown") returns (in the middle
> of the next unit test.)
Interesting. I will see if I can reproduce it.
Dag
Re: ShutdownException when I haven't asked the database to shut down
Posted by Daniel Noll <da...@nuix.com>.
On Tuesday 10 June 2008 02:33:47 Dag H. Wanvik wrote:
> Daniel Noll <da...@nuix.com> writes:
> > If this is the case, is there some way to *know* when the database
> > shutdown has actually occurred?
>
> Normally, if a VM tries to boot a Derby database which is already
> booted by another VM you will get an error (XSDB6).
This is in the same VM, though, just boot, shutdown, copy new database to same
location, boot, shutdown, etc. You know, like normal unit tests.
What If I put a container around Derby and force all queries through that,
blocking queries which occur after shutdown has started, it does appear to
fix the issue.
My theory is that some event was being fired on another thread and then that
resulted in a query which occurred at the same time as shutdown. Derby
mustn't handle this situation by denying that query or terminating it, but
what ends up happening is the shutdown continues and completes some random
time *after* the call to getConnection("...shutdown") returns (in the middle
of the next unit test.)
Daniel
Re: ShutdownException when I haven't asked the database to shut down
Posted by "Dag H. Wanvik" <Da...@Sun.COM>.
Daniel Noll <da...@nuix.com> writes:
> If this is the case, is there some way to *know* when the database
> shutdown has actually occurred?
Normally, if a VM tries to boot a Derby database which is already
booted by another VM you will get an error (XSDB6).
Re: ShutdownException when I haven't asked the database to shut down
Posted by Øystein Grøvlen <Oy...@Sun.COM>.
Daniel Noll wrote:
> Hi all.
>
> I'm getting a load of errors like this. They seem to happen at random times;
> sometimes I see it when creating a statement, sometimes when executing,
> sometimes when iterating over a result set. Once I even had it happen when
> creating the connection itself, which is hard to believe.
>
> Caused by: java.sql.SQLException: Java exception: ': org.apache.derby.iapi.error.ShutdownException'.
> at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
> at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244)
> at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2125)
> at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1325)
> at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1652)
> at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery(EmbedPreparedStatement.java:277)
Does nextException for this exception give you any more information?
Have you checked derby.log? Maybe it contains information that could
shed light on this.
--
Øystein