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

@Contended fails with classes having static fields

XMLWordPrintable

    • b23
    • generic
    • generic
    • Verified

        This was found during the jsr166 testing, first adoption of @Contended in the wild. It turns out making the static fields @Contended breaks the static oop maps, which is then fails spuriously during the GC, resulting in crashes like these:

        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # SIGSEGV (0xb) at pc=0x00007f96e8cafeec, pid=23307, tid=140285777536768
        #
        # JRE version: OpenJDK Runtime Environment (8.0) (build 1.8.0-internal-dl_2013_02_23_13_14-b00)
        # Java VM: OpenJDK 64-Bit Server VM (25.0-b19 mixed mode linux-amd64 compressed oops)
        # Problematic frame:
        # V [libjvm.so+0x507eec] G1ParCopyClosure<false, (G1Barrier)0, false>::copy_to_survivor_space(oopDesc*)+0x3c
        #
        # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
        #
        # An error report file with more information is saved as:
        # /home/dl/concurrent/src/test/jsr166e/hs_err_pid23307.log
        #
        # If you would like to submit a bug report, please visit:
        # http://bugreport.sun.com/bugreport/crash.jsp
        #

        Sometimes it dies at:
        oopDesc* PSPromotionManager::copy_to_survivor_space<false>(oopDesc*)+0x123

        or:
        InstanceKlass::oop_push_contents(PSPromotionManager*, oopDesc*)+0x12c

        Unfortunately, this also breaks the classes annotated with @Contended, because we pessimistically pad the static fields block as well. This wasn't found during original reviews, it slipped the @Contended-targeted regression testing, and would not manifest unless you use @Contended.

        Still, this is the adoption blocker, even though the workaround exists: we can emulate the desired behavior with per-field @Contended annotation.

              shade Aleksey Shipilev
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: