db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kathey Marsden (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-2861) Thread safety issue in TableDescriptor
Date Mon, 10 Mar 2008 22:34:49 GMT

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

Kathey Marsden commented on DERBY-2861:
---------------------------------------

I can't seem to reproduce this on trunk or latest on 10.3. I get only lock timeouts. e.g.
java.sql.SQLException: A lock could not be obtained within the time requested
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
        at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:201)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:391)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
        at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2082)
        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.EmbedStatement.execute(EmbedStatement.java:625)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
        at TestEmbeddedMultiThreading.executeStatement(TestEmbeddedMultiThreading.java:124)
        at TestEmbeddedMultiThreading.access$100(TestEmbeddedMultiThreading.java:25)
        at TestEmbeddedMultiThreading$ViewCreatorDropper.run(TestEmbeddedMultiThreading.java:189)
        at java.lang.Thread.run(Thread.java:803)
Caused by: ERROR 40XL1: A lock could not be obtained within the time requested
        at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:276)
        at org.apache.derby.impl.services.locks.ConcurrentLockSet.lockObject(ConcurrentLockSet.java:602)
        at org.apache.derby.impl.services.locks.AbstractPool.lockObject(AbstractPool.java:117)
        at org.apache.derby.impl.services.locks.ConcurrentPool.lockObject(ConcurrentPool.java:28)
        at org.apache.derby.impl.store.raw.xact.RowLocking2.lockRecordForRead(RowLocking2.java:165)
        at org.apache.derby.impl.store.access.btree.index.B2IRowLocking3._lockScan(B2IRowLocking3.java:127)
        at org.apache.derby.impl.store.access.btree.index.B2IRowLocking3.lockScan(B2IRowLocking3.java:739)
        at org.apache.derby.impl.store.access.btree.index.B2IRowLocking3._lockScanRow(B2IRowLocking3.java:662)
        at org.apache.derby.impl.store.access.btree.index.B2IRowLockingRR.lockScanRow(B2IRowLockingRR.java:112)
        at org.apache.derby.impl.store.access.btree.BTreeScan.positionAtStartForForwardScan(BTreeScan.java:436)
        at org.apache.derby.impl.store.access.btree.BTreeForwardScan.positionAtStartPosition(BTreeForwardScan.java:71)
        at org.apache.derby.impl.store.access.btree.BTreeForwardScan.fetchRows(BTreeForwardScan.java:123)
        at org.apache.derby.impl.store.access.btree.BTreeScan.next(BTreeScan.java:1756)
        at org.apache.derby.impl.sql.execute.IndexChanger.doDelete(IndexChanger.java:335)
        at org.apache.derby.impl.sql.execute.IndexChanger.delete(IndexChanger.java:544)
        at org.apache.derby.impl.sql.execute.IndexSetChanger.delete(IndexSetChanger.java:250)
        at org.apache.derby.impl.sql.execute.RowChangerImpl.deleteRow(RowChangerImpl.java:476)
        at org.apache.derby.impl.sql.catalog.TabInfoImpl.deleteRows(TabInfoImpl.java:750)
        at org.apache.derby.impl.sql.catalog.TabInfoImpl.deleteRow(TabInfoImpl.java:581)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.dropColumnDescriptorCore(DataDictionaryImpl.java:2950)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.dropAllColumnDescriptors(DataDictionaryImpl.java:2452)
        at org.apache.derby.iapi.sql.dictionary.ViewDescriptor.drop(ViewDescriptor.java:411)
        at org.apache.derby.impl.sql.execute.DropViewConstantAction.executeConstantAction(DropViewConstantAction.java:13
4)
        at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:64)
        at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:372)
        at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)
        ... 6 more

Are the lock timeouts expected? Can anyone still reproduce this?


> Thread safety issue in TableDescriptor
> --------------------------------------
>
>                 Key: DERBY-2861
>                 URL: https://issues.apache.org/jira/browse/DERBY-2861
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>         Environment: Tested on a dual-core 3GHz Pentium machine running Windows Vista
Business, using JDK 1.4.2_13 and Derby trunk revision 548822.
>            Reporter: Jeff Clary
>         Attachments: TestEmbeddedMultiThreading.java
>
>
> A NullPointerException occurs in org.apache.derby.iapi.sql.dictionary.TableDescriptor.getObjectName
when accessing the same object on many threads (each with its own connection).  The attached
test program starts N threads each creating and then dropping a separate view against the
same source view, repeated M times.  I can reproduce the problem with N=100 and M=100 on my
machine, but not every run.
> An instance member named referencedColumnMap is checked for null at the top of the getObjectName
method, but later when it is dereferenced it is null, because it was set to null by another
thread.  I am not sure what getObjectName is used for other than error reporting.  I have
considered a fix of just saving the non-null reference as a method variable, to avoid the
later NullPointerException.   But I don't know what unintended consequences this may have.

> When the test program does show the exception, the stack trace looks like this:
>  java.lang.NullPointerException
>    at org.apache.derby.iapi.sql.dictionary.TableDescriptor.getObjectName(TableDescriptor.java:758)
>    at org.apache.derby.impl.sql.depend.BasicDependencyManager.getPersistentProviderInfos(BasicDependencyManager.java:677)
>    at org.apache.derby.impl.sql.compile.CreateViewNode.bindViewDefinition(CreateViewNode.java:287)
>    at org.apache.derby.impl.sql.compile.CreateViewNode.bind(CreateViewNode.java:183)
>    at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:345)
>    at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:119)
>    at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:745)
>    at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:568)
>    at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:517)
>    at TestEmbeddedMultiThreading.executeStatement(TestEmbeddedMultiThreading.java:109)
>    at TestEmbeddedMultiThreading.access$100(TestEmbeddedMultiThreading.java:10)
>    at TestEmbeddedMultiThreading$ViewCreatorDropper.run(TestEmbeddedMultiThreading.java:173)
>    at java.lang.Thread.run(Thread.java:534)
>  

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


Mime
View raw message