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 2010/10/20 19:10:24 UTC

[jira] Created: (DERBY-4859) Missing doPrivileged in DatabaseClasses.WriteClassFile()

Missing doPrivileged in DatabaseClasses.WriteClassFile()
--------------------------------------------------------

                 Key: DERBY-4859
                 URL: https://issues.apache.org/jira/browse/DERBY-4859
             Project: Derby
          Issue Type: Bug
          Components: Services
    Affects Versions: 10.7.0.0
            Reporter: Knut Anders Hatlen
            Priority: Minor


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.

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


[jira] Updated: (DERBY-4859) Missing doPrivileged in DatabaseClasses.WriteClassFile()

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4859?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4859:
--------------------------------------

    Attachment: diff.diff

I'm rerunning the tests on the same configuration with the attached patch applied to see if that'll make the tests report the original error. The patch puts a doPrivileged around the code that opens a new FileOutputStream.

> Missing doPrivileged in DatabaseClasses.WriteClassFile()
> --------------------------------------------------------
>
>                 Key: DERBY-4859
>                 URL: https://issues.apache.org/jira/browse/DERBY-4859
>             Project: Derby
>          Issue Type: Bug
>          Components: Services
>    Affects Versions: 10.7.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: diff.diff
>
>
> 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.

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


[jira] Assigned: (DERBY-4859) Missing doPrivileged in DatabaseClasses.WriteClassFile()

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4859?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen reassigned DERBY-4859:
-----------------------------------------

    Assignee: Knut Anders Hatlen

> Missing doPrivileged in DatabaseClasses.WriteClassFile()
> --------------------------------------------------------
>
>                 Key: DERBY-4859
>                 URL: https://issues.apache.org/jira/browse/DERBY-4859
>             Project: Derby
>          Issue Type: Bug
>          Components: Services
>    Affects Versions: 10.7.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>
> 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.

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


[jira] Updated: (DERBY-4859) Missing doPrivileged in DatabaseClasses.WriteClassFile()

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4859?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4859:
--------------------------------------

    Issue & fix info: [Patch Available]

> Missing doPrivileged in DatabaseClasses.WriteClassFile()
> --------------------------------------------------------
>
>                 Key: DERBY-4859
>                 URL: https://issues.apache.org/jira/browse/DERBY-4859
>             Project: Derby
>          Issue Type: Bug
>          Components: Services
>    Affects Versions: 10.7.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: diff.diff
>
>
> 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.

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


[jira] Commented: (DERBY-4859) Missing doPrivileged in DatabaseClasses.WriteClassFile()

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12923249#action_12923249 ] 

Dag H. Wanvik commented on DERBY-4859:
--------------------------------------

Seems a good incremental improvement, +1


> Missing doPrivileged in DatabaseClasses.WriteClassFile()
> --------------------------------------------------------
>
>                 Key: DERBY-4859
>                 URL: https://issues.apache.org/jira/browse/DERBY-4859
>             Project: Derby
>          Issue Type: Bug
>          Components: Services
>    Affects Versions: 10.7.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: diff.diff
>
>
> 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.

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


[jira] Commented: (DERBY-4859) Missing doPrivileged in DatabaseClasses.WriteClassFile()

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12923073#action_12923073 ] 

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

With the patch, I got the expected OutOfMemoryError instead:

1) testCSBug735(org.apache.derbyTesting.functionTests.tests.store.AccessTest)jav
a.sql.SQLException: Java exception: 'PermGen space: java.lang.OutOfMemoryError'.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unkn
own Source)
(...)
Caused by: java.lang.OutOfMemoryError: PermGen space
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:466)
        at org.apache.derby.impl.services.reflect.ReflectLoaderJava2.loadGeneratedClass(Unknown Source)
        at org.apache.derby.impl.services.reflect.ReflectClassesJava2.loadGeneratedClassFromData(Unknown Source)
        at org.apache.derby.impl.services.reflect.DatabaseClasses.loadGeneratedClass(Unknown Source)

It didn't happen in the exact same test case, but it was still in DatabaseClasses.loadGeneratedClass(), so the code modified by the patch was exercised. I also see that the generated class did get written to disk this time, so it seems to work as expected now.

> Missing doPrivileged in DatabaseClasses.WriteClassFile()
> --------------------------------------------------------
>
>                 Key: DERBY-4859
>                 URL: https://issues.apache.org/jira/browse/DERBY-4859
>             Project: Derby
>          Issue Type: Bug
>          Components: Services
>    Affects Versions: 10.7.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: diff.diff
>
>
> 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.

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


[jira] Closed: (DERBY-4859) Missing doPrivileged in DatabaseClasses.WriteClassFile()

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4859?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen closed DERBY-4859.
-------------------------------------

          Resolution: Fixed
       Fix Version/s: 10.7.0.0
    Issue & fix info:   (was: [Patch Available])

Thanks, Dag.
Committed revision 1025888.

> Missing doPrivileged in DatabaseClasses.WriteClassFile()
> --------------------------------------------------------
>
>                 Key: DERBY-4859
>                 URL: https://issues.apache.org/jira/browse/DERBY-4859
>             Project: Derby
>          Issue Type: Bug
>          Components: Services
>    Affects Versions: 10.7.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>             Fix For: 10.7.0.0
>
>         Attachments: diff.diff
>
>
> 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.

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