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

Myrna van Lunteren commented on DERBY-6352:
-------------------------------------------

Thanks Knut, I'll go and implement this then.
The Java call Stack from the jvm's informational dump suggests the finalizer 
comes from the EmbedConnection (this is based on a 10.10.1.4 build):
----------------------------
3XMTHREADINFO      "Finalizer thread" J9VMThread:0x00000000007A0200, 
j9thread_t:0x000000000079F1A0, java/lang/Thread:0x00007F7868697F90, state:B, 
prio=5
3XMJAVALTHREAD            (java/lang/Thread getId:0xB, isDaemon:true)
3XMTHREADINFO1            (native thread ID:0x4553, native priority:0x5, native 
policy:UNKNOWN)
3XMTHREADINFO2            (native stack address range from:0x00007F7865B10000, 
to:0x00007F7865B51000, size:0x41000)
3XMTHREADINFO3           Java callstack:
4XESTACKTRACE                at 
org/apache/derby/iapi/services/context/SystemContext.cleanupOnError(Bytecode 
PC:76(Compiled Code))
4XESTACKTRACE                at 
org/apache/derby/iapi/services/context/ContextManager.cleanupOnError(Bytecode 
PC:271(Compiled Code))
4XESTACKTRACE                at 
org/apache/derby/impl/jdbc/TransactionResourceImpl.cleanupOnError(Bytecode 
PC:6(Compiled Code))
4XESTACKTRACE                at 
org/apache/derby/impl/jdbc/EmbedConnection.close(Bytecode PC:73(Compiled Code))
4XESTACKTRACE                at 
org/apache/derby/impl/jdbc/EmbedConnection.finalize(Bytecode PC:12(Compiled 
Code))
4XESTACKTRACE                at 
java/lang/J9VMInternals.runFinalize(J9VMInternals.java:438(Compiled Code))
-------------------

> Access denied ("java.lang.RuntimePermission" "modifyThread") highly 
> intermittent, but e.g. in store.RecoveryAfterBackup test
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-6352
>                 URL: https://issues.apache.org/jira/browse/DERBY-6352
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.9.2.2, 10.10.1.1
>         Environment: IBM java 7 Derby version 10.10.1.2 - (1494414)
>            Reporter: Kathey Marsden
>         Attachments: DERBY-6352_trunk.diff, DERBY-6352_trunk2.diff, 
> javacore_1.zip, javacore_2.zip, test-case.diff
>
>
> I got a report of the following intermittent (6/60) exception in 
> store.RecoveryAfterBackupTest.
> Exception in thread "main" java.security.AccessControlException: Access 
> denied ("java.lang.RuntimePermission" "modifyThread")
>                at 
> java.security.AccessController.throwACE(AccessController.java:100)
>                at 
> java.security.AccessController.checkPermission(AccessController.java:174)
>                at 
> java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
>                at 
> java.lang.SecurityManager.checkAccess(SecurityManager.java:676)
>                at java.lang.Thread.checkAccess(Thread.java:459)
>                at java.lang.Thread.interrupt(Thread.java:588)
>                at 
> org.apache.derby.iapi.services.context.ContextService$1.run(Unknown Source)
>                at 
> java.security.AccessController.doPrivileged(AccessController.java:274)
>                at 
> org.apache.derby.iapi.services.context.ContextService.notifyAllActiveThreads(Unknown
>  Source)
>                at 
> org.apache.derby.impl.services.monitor.BaseMonitor.shutdown(Unknown Source)
>                at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
>                at org.apache.derby.jdbc.Driver20.connect(Unknown Source)
>                at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown 
> Source)
>                at java.sql.DriverManager.getConnection(DriverManager.java:571)
>                at java.sql.DriverManager.getConnection(DriverManager.java:233)
>                at 
> org.apache.derbyTesting.functionTests.util.TestUtil.getConnection(TestUtil.java:836)
>                at 
> org.apache.derbyTesting.functionTests.tests.store.RecoveryAfterBackup.main(RecoveryAfterBackup.java:82)
> modifyThread is a necessary permission if interrupting a thread other than 
> the current thread but is not in our policy file for derby.jar.
> The relevant code in ContextService is:
>            for (ContextManager cm : allContexts) {
>                               Thread active = cm.activeThread;
>                               if (active == me)
>                                       continue;
>                               if (active == null)
>                                       continue;
>                 final Thread fActive = active;
>                               if (cm.setInterrupted(c))
>                 {
>                     AccessController.doPrivileged(
>                             new PrivilegedAction<Void>() {
>                                 public Void run()  {
>                                     fActive.interrupt();
>                                     return null;
>                                 }
>                             });
>                 }
>               
> I am not sure why this has never come up before.  Are we expecting in this 
> context that fActive is the current thread?
>  



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to