[
https://issues.apache.org/jira/browse/DERBY-5312?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dag H. Wanvik updated DERBY-5312:
---------------------------------
Attachment: derby-5312a.diff
Thanks, Mike. I think I understand why this is happening now.
One thread sees an interrupt and goes on to reopen the container to get the NIO
channel up again. During reopening the "canUpdate" state variable is briefly
set to false before being set to true again. Meanwhile, another another thread
is accessing the container, cf. the call stack of this issue. During that
access, BaseContainer#use calls FileContainer#canUpdate and (sometimes) reads
the "false" value in the short time window in question.
Uploading a patch which omits setting "canUpdate" during reopening of the
container. It should not have changed during the brief period the channel was
closed due to the interrupt, so this seems ok, cf. the Javadoc for the variable
"canUpdate": it should only change when we reset the identity of the container.
> InterruptResilienceTest failed with ERROR 40XD1: Container was opened in
> read-only mode.
> ----------------------------------------------------------------------------------------
>
> Key: DERBY-5312
> URL: https://issues.apache.org/jira/browse/DERBY-5312
> Project: Derby
> Issue Type: Bug
> Components: Store
> Affects Versions: 10.9.0.0
> Environment: Oracle Solaris 11 Express snv_151a X86
> java version "1.7.0"
> Java(TM) SE Runtime Environment (build 1.7.0-b147)
> Java HotSpot(TM) Server VM (build 21.0-b17, mixed mode)
> Reporter: Knut Anders Hatlen
> Assignee: Dag H. Wanvik
> Attachments: derby-5312a.diff, derby.log, error-stacktrace.out
>
>
> WorkerThread failed with this exception:
> ERROR 40XD1: Container was opened in read-only mode.
> at
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:276)
> at
> org.apache.derby.impl.store.raw.data.BaseContainer.use(BaseContainer.java:562)
> at
> org.apache.derby.impl.store.raw.data.BaseContainerHandle.useContainer(BaseContainerHandle.java:834)
> at
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(BaseDataFileFactory.java:773)
> at
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(BaseDataFileFactory.java:589)
> at
> org.apache.derby.impl.store.raw.xact.Xact.openContainer(Xact.java:1316)
> at
> org.apache.derby.impl.store.access.btree.OpenBTree.init(OpenBTree.java:382)
> at
> org.apache.derby.impl.store.access.btree.BTreeController.init(BTreeController.java:1225)
> at
> org.apache.derby.impl.store.access.btree.index.B2IController.init(B2IController.java:140)
> at org.apache.derby.impl.store.access.btree.index.B2I.open(B2I.java:824)
> at
> org.apache.derby.impl.store.access.RAMTransaction.openConglomerate(RAMTransaction.java:476)
> at
> org.apache.derby.impl.store.access.RAMTransaction.openCompiledConglomerate(RAMTransaction.java:1293)
> at
> org.apache.derby.impl.sql.execute.IndexChanger.openIndexCC(IndexChanger.java:507)
> at
> org.apache.derby.impl.sql.execute.IndexChanger.insertAndCheckDups(IndexChanger.java:438)
> at
> org.apache.derby.impl.sql.execute.IndexChanger.doInsert(IndexChanger.java:383)
> at
> org.apache.derby.impl.sql.execute.IndexChanger.insert(IndexChanger.java:590)
> at
> org.apache.derby.impl.sql.execute.IndexSetChanger.insert(IndexSetChanger.java:268)
> at
> org.apache.derby.impl.sql.execute.RowChangerImpl.insertRow(RowChangerImpl.java:453)
> at
> org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(InsertResultSet.java:999)
> at
> org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:519)
> 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)
> at
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1686)
> at
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:308)
> at
> org.apache.derbyTesting.functionTests.tests.store.InterruptResilienceTest$WorkerThread.run(InterruptResilienceTest.java:449)
> I was testing a patch for DERBY-4620 (estimate-sizes.diff), but I think the
> failure isn't related to those changes.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira