Derby
  1. Derby
  2. DERBY-4859

Missing doPrivileged in DatabaseClasses.WriteClassFile()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.7.1.1
    • Fix Version/s: 10.7.1.1
    • Component/s: Services
    • Labels:
      None

      Description

      One of my test runs failed with the following error:

      1) testAllUncommittedReclaim(org.apache.derbyTesting.functionTests.tests.store.AccessTest)java.sql.SQLException: Java exception: 'access denied (java.io.FilePermission /export/home/tmp/kh160127/derbyall/system/ac72985692x012bxc9d4x9594xffffa08cb27a0.class write): java.security.AccessControlException'.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
      (...)
      Caused by: java.security.AccessControlException: access denied (java.io.FilePermission /export/home/tmp/kh160127/derbyall/system/ac72985692x012bxc9d4x9594xffffa08cb27a0.class write)
      at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
      at java.security.AccessController.checkPermission(AccessController.java:546)
      at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
      at java.lang.SecurityManager.checkWrite(SecurityManager.java:962)
      at java.io.FileOutputStream.<init>(FileOutputStream.java:169)
      at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
      at org.apache.derby.impl.services.reflect.DatabaseClasses.WriteClassFile(Unknown Source)
      at org.apache.derby.impl.services.reflect.DatabaseClasses.loadGeneratedClass(Unknown Source)
      (...)

      I think the underlying error is an OutOfMemoryError, because I have seen tests running out of permgen space with the same configuration lately. But that error never gets all the way out to the test framework because of the above file permission error.

      When DatabaseClasses.loadGeneratedClass() fails with a LinkageError or a VirtualMachineError (the super-class of OutOfMemoryError), it attempts to dump the generated class to disk. But since the tests run under a security manager, and the code writes the class to disk isn't wrapped in a privileged block, the dumping of extra debug info fails and hides the original error.

      1. diff.diff
        2 kB
        Knut Anders Hatlen

        Activity

        Knut Anders Hatlen created issue -
        Knut Anders Hatlen made changes -
        Field Original Value New Value
        Assignee Knut Anders Hatlen [ knutanders ]
        Knut Anders Hatlen made changes -
        Attachment diff.diff [ 12457682 ]
        Knut Anders Hatlen made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Knut Anders Hatlen made changes -
        Issue & fix info [Patch Available]
        Knut Anders Hatlen made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Issue & fix info [Patch Available]
        Fix Version/s 10.7.0.0 [ 12314971 ]
        Resolution Fixed [ 1 ]
        Rick Hillegas made changes -
        Affects Version/s 10.7.1.1 [ 12315564 ]
        Affects Version/s 10.7.1.0 [ 12314971 ]
        Fix Version/s 10.7.1.1 [ 12315564 ]
        Fix Version/s 10.7.1.0 [ 12314971 ]
        Gavin made changes -
        Workflow jira [ 12524771 ] Default workflow, editable Closed status [ 12800488 ]

          People

          • Assignee:
            Knut Anders Hatlen
            Reporter:
            Knut Anders Hatlen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development