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

G1 logging ignores changes to PrintGC* flags via MXBeans

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 8, 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
      gc
    • Resolved In Build:
      b66

      Backports

        Description

        VM flags PrintGC, PrintGCDetails and PrintGCTimeStamps are manageable, it means one could alter their initial values calling MXBean.

        This works for all collectors, but G1. G1 takes only initial setting into account.
        A minimized test demonstrating the problem is attached LogTest


        1) java -XX:+UseParallelGC LogTest
        ----------------------
        PrintGC true
        ----------------------
        0.155: [GC (System.gc()) [PSYoungGen: 639K->496K(4096K)] 639K->496K(63488K), 0.0022237 secs] [Times: user=0.01 sys=0.00, real=0.00 secs]
        0.158: [Full GC (System.gc()) [PSYoungGen: 496K->0K(4096K)] [ParOldGen: 0K->445K(59392K)] 496K->445K(63488K), [Metaspace: 2810K->2810K(1056768K)], 0.0090386 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
        ....

        works fine

        2) java -XX:+UseParallelGC LogTest no
        ----------------------
        PrintGC false
        ----------------------

        works fine

        3) java -XX:+UseG1GC LogTest no
        ----------------------
        PrintGC false
        ----------------------

        works fine

        4) java -XX:+UseG1GC LogTest
        ----------------------
        PrintGC true
        ----------------------
        Heap
         garbage-first heap total 8192K, used 446K [0x00000000c0000000, 0x00000000c0800000, 0x0000000100000000)
          region size 1024K, 1 young (1024K), 0 survivors (0K)
         Metaspace used 2817K, capacity 4486K, committed 4864K, reserved 1056768K
          class space used 314K, capacity 386K, committed 512K, reserved 1048576K

        works wrong: no Full GC in output!


        5) java -XX:+UseG1GC -XX:+PrintGC LogTest
        ----------------------
        PrintGC true
        ----------------------
        0.146: [Full GC (System.gc()) 657K->446K(8192K), 0.0131295 secs]
        Heap
         garbage-first heap total 8192K, used 446K [0x00000000c0000000, 0x00000000c0800000, 0x0000000100000000)
          region size 1024K, 1 young (1024K), 0 survivors (0K)
         Metaspace used 2817K, capacity 4486K, committed 4864K, reserved 1056768K
          class space used 314K, capacity 386K, committed 512K, reserved 1048576K

        works fine

        6) java -XX:+UseG1GC -XX:+PrintGC LogTest off
        ----------------------
        PrintGC false
        ----------------------
        [Full GC (System.gc()) 657K->446K(8192K), 0.0123265 secs]

        works wrong: Full GC is printed out!











          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  dfazunen Dmitry Fazunenko (Inactive)
                  Reporter:
                  dfazunen Dmitry Fazunenko (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: