Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-6334

Test harness security policy prevents running DatabaseClassLoadingTest twice

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 10.11.1.1
    • 10.13.1.0
    • Test
    • None
    • Newcomer, Repro attached

    Description

      If I try to run DatabaseClassLoadingTest twice in a row, the second run
      immediately fails with a AccessControlException.

      To reproduce the problem:

      1) cd to a fresh empty directory

      2) java junit.textui.TestRunner org.apache.derbyTesting.functionTests.tests.lang.DatabaseClassLoadingTest

      (test will pass)

      3) java junit.textui.TestRunner org.apache.derbyTesting.functionTests.tests.lang.DatabaseClassLoadingTest

      (test will fail with an AccessControlException)

      It's possible that this is due to a problem with the security policy that the
      test harness includes for running the unit tests?

      I'll include the stack trace in a comment to this issue.

      Attachments

        Activity

          java.security.AccessControlException: access denied ("java.io.FilePermission" "C
          :\Users\Bryan\derby\tests\system\wombat\jar\e66540fa-0140-eb6c-e466-00004fd8b4bd
          .jar.G1378339326751" "read")
          at java.security.AccessControlContext.checkPermission(Unknown Source)
          at java.security.AccessController.checkPermission(Unknown Source)
          at java.lang.SecurityManager.checkPermission(Unknown Source)
          at java.lang.SecurityManager.checkRead(Unknown Source)
          at java.io.File.exists(Unknown Source)
          at org.apache.derby.impl.store.raw.data.RemoveFileOperation.needsRedo(RemoveFileOperation.java:154)
          at org.apache.derby.impl.store.raw.log.FileLogger.redo(FileLogger.java:1395)
          at org.apache.derby.impl.store.raw.log.LogToFile.recover(LogToFile.java:932)
          at org.apache.derby.impl.store.raw.RawStore.boot(RawStore.java:337)
          at org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1991)
          at org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:334)
          at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(BaseMonitor.java:541)
          at org.apache.derby.impl.services.monitor.FileMonitor.startModule(FileMonitor.java:44)
          at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Monitor.java:423)
          at org.apache.derby.impl.store.access.RAMAccessManager.boot(RAMAccessManager.java:1000)
          at org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1991)
          at org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:334)
          at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(BaseMonitor.java:541)
          at org.apache.derby.impl.services.monitor.FileMonitor.startModule(FileMonitor.java:44)
          at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Monitor.java:423)
          at org.apache.derby.impl.db.BasicDatabase.bootStore(BasicDatabase.java:760)
          at org.apache.derby.impl.db.BasicDatabase.boot(BasicDatabase.java:177)
          at org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1991)
          at org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:334)
          at org.apache.derby.impl.services.monitor.BaseMonitor.bootService(BaseMonitor.java:1819)
          at org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(BaseMonitor.java:1685)
          at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(BaseMonitor.java:1569)
          at org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(BaseMonitor.java:988)
          at org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Monitor.java:546)
          at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2802)
          at org.apache.derby.impl.jdbc.EmbedConnection.<init>EmbedConnection.java:404)
          at org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(InternalDriver.java:628)
          at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:282)

          at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:913)

          at org.apache.derby.jdbc.AutoloadedDriver.connect(AutoloadedDriver.java:147)
          at java.sql.DriverManager.getConnection(Unknown Source)
          at java.sql.DriverManager.getConnection(Unknown Source)
          at org.apache.derbyTesting.junit.DriverManagerConnector.openConnection(DriverManagerConnector.java:100)
          at org.apache.derbyTesting.junit.DriverManagerConnector.openConnection(DriverManagerConnector.java:67)
          at org.apache.derbyTesting.junit.DriverManagerConnector.openConnection(DriverManagerConnector.java:43)
          at org.apache.derbyTesting.junit.TestConfiguration.openDefaultConnection(TestConfiguration.java:1707)
          at org.apache.derbyTesting.junit.BaseJDBCTestSetup.getConnection(BaseJDBCTestSetup.java:72)
          at org.apache.derbyTesting.junit.CleanDatabaseTestSetup.setUp(CleanDatabaseTestSetup.java:103)
          at junit.extensions.TestSetup$1.protect(TestSetup.java:20)
          at junit.framework.TestResult.runProtected(TestResult.java:124)
          at junit.extensions.TestSetup.run(TestSetup.java:25)
          at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
          at junit.textui.TestRunner.doRun(TestRunner.java:121)
          at junit.textui.TestRunner.start(TestRunner.java:185)
          at junit.textui.TestRunner.main(TestRunner.java:143)

          bryanpendleton Bryan Pendleton added a comment - java.security.AccessControlException: access denied ("java.io.FilePermission" "C :\Users\Bryan\derby\tests\system\wombat\jar\e66540fa-0140-eb6c-e466-00004fd8b4bd .jar.G1378339326751" "read") at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkRead(Unknown Source) at java.io.File.exists(Unknown Source) at org.apache.derby.impl.store.raw.data.RemoveFileOperation.needsRedo(RemoveFileOperation.java:154) at org.apache.derby.impl.store.raw.log.FileLogger.redo(FileLogger.java:1395) at org.apache.derby.impl.store.raw.log.LogToFile.recover(LogToFile.java:932) at org.apache.derby.impl.store.raw.RawStore.boot(RawStore.java:337) at org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1991) at org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:334) at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(BaseMonitor.java:541) at org.apache.derby.impl.services.monitor.FileMonitor.startModule(FileMonitor.java:44) at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Monitor.java:423) at org.apache.derby.impl.store.access.RAMAccessManager.boot(RAMAccessManager.java:1000) at org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1991) at org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:334) at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(BaseMonitor.java:541) at org.apache.derby.impl.services.monitor.FileMonitor.startModule(FileMonitor.java:44) at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Monitor.java:423) at org.apache.derby.impl.db.BasicDatabase.bootStore(BasicDatabase.java:760) at org.apache.derby.impl.db.BasicDatabase.boot(BasicDatabase.java:177) at org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1991) at org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:334) at org.apache.derby.impl.services.monitor.BaseMonitor.bootService(BaseMonitor.java:1819) at org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(BaseMonitor.java:1685) at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(BaseMonitor.java:1569) at org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(BaseMonitor.java:988) at org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Monitor.java:546) at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2802) at org.apache.derby.impl.jdbc.EmbedConnection.<init>EmbedConnection.java:404) at org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(InternalDriver.java:628) at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:282) at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:913) at org.apache.derby.jdbc.AutoloadedDriver.connect(AutoloadedDriver.java:147) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at org.apache.derbyTesting.junit.DriverManagerConnector.openConnection(DriverManagerConnector.java:100) at org.apache.derbyTesting.junit.DriverManagerConnector.openConnection(DriverManagerConnector.java:67) at org.apache.derbyTesting.junit.DriverManagerConnector.openConnection(DriverManagerConnector.java:43) at org.apache.derbyTesting.junit.TestConfiguration.openDefaultConnection(TestConfiguration.java:1707) at org.apache.derbyTesting.junit.BaseJDBCTestSetup.getConnection(BaseJDBCTestSetup.java:72) at org.apache.derbyTesting.junit.CleanDatabaseTestSetup.setUp(CleanDatabaseTestSetup.java:103) at junit.extensions.TestSetup$1.protect(TestSetup.java:20) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.extensions.TestSetup.run(TestSetup.java:25) at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57) at junit.textui.TestRunner.doRun(TestRunner.java:121) at junit.textui.TestRunner.start(TestRunner.java:185) at junit.textui.TestRunner.main(TestRunner.java:143)

          This seems to be resolved. The test runs twice in a row fine for me. It may be related to this fix:
          r1582655 | kahatlen | 2014-03-28 02:44:37 -0700 (Fri, 28 Mar 2014) | 7 lines

          DERBY-5615: Permission problems with classpath subsubprotocol

          Wrap CPFile's privileged operations in doPrivileged() so that
          classpath databases can be accessed with a security manager.

          Make more of the test cases in DatabaseClassLoadingTest and
          NativeAuthenticationServiceTest run with a security manager.

          Bryan, you ok with resolving this issue?

          kmarsden Katherine Marsden added a comment - This seems to be resolved. The test runs twice in a row fine for me. It may be related to this fix: r1582655 | kahatlen | 2014-03-28 02:44:37 -0700 (Fri, 28 Mar 2014) | 7 lines DERBY-5615 : Permission problems with classpath subsubprotocol Wrap CPFile's privileged operations in doPrivileged() so that classpath databases can be accessed with a security manager. Make more of the test cases in DatabaseClassLoadingTest and NativeAuthenticationServiceTest run with a security manager. Bryan, you ok with resolving this issue?

          Hi Kathey,

          I agree, the test is running fine for me too, multiple times in a row.

          I'm not exactly sure which release Knut Anders's fix was in. I did my
          re-testing in trunk, so I marked the issue as resolved in 10.13.

          Thanks for following up!

          bryanpendleton Bryan Pendleton added a comment - Hi Kathey, I agree, the test is running fine for me too, multiple times in a row. I'm not exactly sure which release Knut Anders's fix was in. I did my re-testing in trunk, so I marked the issue as resolved in 10.13. Thanks for following up!

          [ Automatically closing all resolved issues that haven't been updated in more than six months. ]

          knutanders Knut Anders Hatlen added a comment - [ Automatically closing all resolved issues that haven't been updated in more than six months. ]

          People

            Unassigned Unassigned
            bryanpendleton Bryan Pendleton
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: