Applets loading very slow on Java 8u 45 with stack

2019-09-06 20:24发布

问题:

I am getting a Stackoverflow error on Java Console while opening the Applets over network on Java Version 8 build 1.8.0_45-b15 . The applet gets loaded but takes around 8 minutes and the same works fine in any of the Java 7 versions over the network .

Can anyone please help .. The stacktrace is as follows .

java.lang.StackOverflowError
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.provider.PolicyFile.getPermissions(Unknown Source)
at sun.security.provider.PolicyFile.getPermissions(Unknown Source)
at sun.security.provider.PolicyFile.implies(Unknown Source)
at java.security.ProtectionDomain.implies(Unknown Source)
at java.security.AccessControlContext.checkPermission(U

回答1:

I have a similar problem and finding.

We are using an applet in Firefox. Current Testing versions:

  • Firefox: 46.0.1
  • Java: jre1.8.0_51 (32bit)

I used JFR (Java Flight Recorder) and Oracle Mission Control to analyse a long hang (about 5s) on startup of our UI.

My finding so far is that the method Permissions.implies() takes extremely long for an unknown reason.

My analysis showed 2 long blocked stacks for 2 different threads which both were hanging long (about 2s & 4s) in this method.

Here is one call stack that JMC isolated: (For reference: 4.340.000.123ns = 4.34s)

Stack Trace Count   Duration (ns)
java.security.Permissions.implies(Permission)   1   4.340.000.123
sun.security.provider.PolicyFile.implies(ProtectionDomain, Permission)  1   4.340.000.123
java.security.ProtectionDomain.implies(Permission)  1   4.340.000.123
java.security.AccessControlContext.checkPermission(Permission)  1   4.340.000.123
java.security.AccessController.checkPermission(Permission)  1   4.340.000.123
java.lang.SecurityManager.checkPermission(Permission)   1   4.340.000.123
sun.plugin2.applet.AWTAppletSecurityManager.checkPermission(Permission) 1   4.340.000.123
java.lang.SecurityManager.hasAllPermission()    1   4.340.000.123
java.lang.SecurityManager.currentClassLoader()  1   4.340.000.123
sun.plugin2.applet.AWTAppletSecurityManager.getCurrentClassLoader() 1   4.340.000.123
sun.plugin2.applet.AWTAppletSecurityManager.getThreadGroup()    1   4.340.000.123
java.lang.Thread.init(ThreadGroup, Runnable, String, long, AccessControlContext)    1   4.340.000.123
java.lang.Thread.init(ThreadGroup, Runnable, String, long)  1   4.340.000.123
java.lang.Thread.<init>(String) 1   4.340.000.123
MyClass2.<init>()   1   4.340.000.123
MyClass.treatNew(Protocol)  1   4.340.000.123
MyClass.treatNewDecode(String, int) 1   4.340.000.123
MyClass.run()   1   4.340.000.123
java.lang.Thread.run()  1   4.340.000.123