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

ZGC: Handle incorrect processor id reported by the operating system

XMLWordPrintable

    • gc
    • b35
    • Not verified

        Some environments (e.g. OpenVZ containers) incorrectly report a logical processor id that is higher than the number of processors available. This is problematic, for example, when implementing CPU-local data structures, where the processor id is used to index into an array of length processor_count().

        We've received crash reports from Jelastic (a Virtuozzo/OpenVZ user) where they run into this problem. We can workaround the problem in the JVM, until the underlying problem is fixed. Without this workaround ZGC can't be used in this environment.

        This is currently a ZGC-specific issue, since ZGC is currently the only part of HotSpot that is using CPU-local data structures, but that could change in the future.

        Just to clarify. In a Virtuozzo/OpenZV environment, it seems the underlying problem is not necessarily that `sched_getcpu()` returns an incorrect processor id, but rather that `sysconf(_SC_NPROCESSORS_CONF)` returns a too low number. Either way, `sched_getcpu()` and `syconf(_SC_NPROCESSORS_CONF)` seems to have different views of the world. This is not an issue in container environments such as Docker.

              pliden Per Liden (Inactive)
              pliden Per Liden (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: