Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8166852

JavaScript engine eval() method causes JVM Young GC to pauses seconds

    XMLWordPrintable

Details

    Description

      JavaScript engine eval() method causes JVM Young GC to pauses seconds

      import javax.script.*;

      public class Test {

        public static void main(String[] args) throws InterruptedException {
         ScriptEngine engine = new
      ScriptEngineManager().getEngineByName("nashorn");
         String s = "";
         while (true) {
           try {
             Object o = engine.eval(s);
           } catch (ScriptException e) {
             System.err.println("Error:" + e);
           }
         }
       }
      }

      run the test case with -XX:+PrintGCDetails -Xms64m -Xmx64m, and it shows
      an increasing YG collection time:

      0.996: [GC (Allocation Failure) [PSYoungGen: 12288K->3608K(16384K)]
      12288K->3616K(61440K)
      , 0.0330406 secs] [Times: user=0.64 sys=0.06, real=0.03 secs]
      ...
      71.314: [GC (Allocation Failure) [PSYoungGen: 12288K->0K(16384K)]
      14777K->2489K(61440K),
      0.0710348 secs] [Times: user=0.10 sys=0.01, real=0.07 secs]
      ...
      164.642: [GC (Allocation Failure) [PSYoungGen: 12288K->0K(16384K)]
      14777K->2489K(61440K),
       0.1435001 secs] [Times: user=0.18 sys=0.01, real=0.14 secs]
      ...
      553.083: [GC (Allocation Failure) [PSYoungGen: 12288K->0K(16384K)]
      14777K->2489K(61440K),
       2.3574281 secs] [Times: user=8.13 sys=0.37, real=2.36 secs]

      Attachments

        Issue Links

          Activity

            People

              kevinw Kevin Walls
              shadowbug Shadow Bug
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: