You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2012/12/10 15:59:21 UTC

[jira] [Commented] (DERBY-5894) NPE in OnlineBackupTest1 while backing up in stubFileToRemoveAfterCheckPoint

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

Knut Anders Hatlen commented on DERBY-5894:
-------------------------------------------

The stack trace says:

        at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.stubFileToRemoveAfterCheckPoint(BaseDataFileFactory.java:1613)
        at org.apache.derby.impl.store.raw.data.RAFContainer.run(RAFContainer.java:1651)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.derby.impl.store.raw.data.RAFContainer.backupContainer(RAFContainer.java:983) 

However, backupContainer()'s call to doPrivileged() is supposed to end up calling privBackupContainer(), not stubFileToRemoveAfterCheckPoint(). I think this may happen if backupContainer() is called concurrently with one of the other RAFContainer methods that call doPrivileged(). Since backupContainer() is not synchronized, a call to one of the other RAFContainer methods (in the case reported here: RAFContainer.stubbify()) in another thread may proceed and change the value of actionCode while backupContainer() is executing. This makes the switch statement in RAFContainer.run() pick the wrong action, and if the execution of stubbify() has come so far as to resetting the actionInstant field to null before backupContainer() has completed, backupContainer() may fail with the reported NullPointerException.

The fix would be to synchronize backupContainer(). All the other methods in RAFContainer that call doPrivileged(), are already synchronized.
                
> NPE in OnlineBackupTest1 while backing up in stubFileToRemoveAfterCheckPoint
> ----------------------------------------------------------------------------
>
>                 Key: DERBY-5894
>                 URL: https://issues.apache.org/jira/browse/DERBY-5894
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>            Reporter: Dag H. Wanvik
>              Labels: derby_triage10_10
>         Attachments: d5894.zip
>
>
> Saw this while running OnlineBackupTest1 trying to repro DERBY-973.
> ERROR 38000: The exception 'java.lang.NullPointerException' was thrown while evaluating an expression.
>         at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:288)
>         at org.apache.derby.iapi.error.StandardException.unexpectedUserException(StandardException.java:575)
>         at org.apache.derby.impl.services.reflect.ReflectMethod.invoke(ReflectMethod.java:63)
>         at org.apache.derby.impl.sql.execute.CallStatementResultSet.open(CallStatementResultSet.java:75)
>         at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:443)
>         at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:324)
>         at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1242)
>         at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1715)
>         at org.apache.derby.impl.jdbc.EmbedCallableStatement.executeStatement(EmbedCallableStatement.java:118)
>         at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(EmbedPreparedStatement.java:1370)
>         at org.apache.derbyTesting.functionTests.tests.store.OnlineBackup.performBackup(OnlineBackup.java:89)
>         at org.apache.derbyTesting.functionTests.tests.store.OnlineBackup.run(OnlineBackup.java:60)
>         at java.lang.Thread.run(Thread.java:637)
> Caused by: java.lang.NullPointerException
>         at java.util.Hashtable.put(Hashtable.java:401)
>         at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.stubFileToRemoveAfterCheckPoint(BaseDataFileFactory.java:1613)
>         at org.apache.derby.impl.store.raw.data.RAFContainer.run(RAFContainer.java:1651)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at org.apache.derby.impl.store.raw.data.RAFContainer.backupContainer(RAFContainer.java:983)
>         at org.apache.derby.impl.store.raw.data.BaseContainerHandle.backupContainer(BaseContainerHandle.java:1031)
>         at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.backupDataFiles(BaseDataFileFactory.java:2466)
>         at org.apache.derby.impl.store.raw.RawStore.backup(RawStore.java:978)
>         at org.apache.derby.impl.store.raw.RawStore.backup(RawStore.java:649)
>         at org.apache.derby.impl.store.access.RAMAccessManager.backup(RAMAccessManager.java:964)
>         at org.apache.derby.impl.db.BasicDatabase.backup(BasicDatabase.java:430)
>         at org.apache.derby.catalog.SystemProcedures.SYSCS_BACKUP_DATABASE(SystemProcedures.java:961)
>         at org.apache.derby.exe.acf33d40c7x0138x6d7cx6df3x0000720ad17b0.g0(Unknown Source)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:592)
>         at org.apache.derby.impl.services.reflect.ReflectMethod.invoke(ReflectMethod.java:46)
>         ... 10 more

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira