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

-Xshare:dump should not call vm_direct_exit

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 20
    • 18
    • hotspot
    • b06

      See https://github.com/openjdk/jdk/blob/0aa63feca8704c8958530ef9e3df128570c50e12/src/hotspot/share/cds/metaspaceShared.cpp#L579

        // There may be pending VM operations. We have changed some global states
        // (such as vmClasses::_klasses) that may cause these VM operations
        // to fail. For safety, forget these operations and exit the VM directly.
        vm_direct_exit(0);


      This is unsafe because C++ global destructors may be executed as a result of calling vm_direct_exit. This may cause a race condition with concurrent GC threads that are updating global objects and result in a crash.

      Suggested fix:

      - As a hack, we could call _exit(), which will quit the process without doing global cleanups
      - But a more wholesome fix would be to avoid modifying the global states (such as vmClasses::_klasses) during -Xshare:dump. This should be fairly easy to implement.

            ccheung Calvin Cheung
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: