Running the following command line causes a crash in os::Linux::rebuild_cpu_to_node_map:
numactl -m 0 -c 0 /localhome/java/jdk9-107/bin/java -XX:+UseNUMA -version
The crash is reproducible starting from JDK 9 build 107.
Relevant pieces of the code:
size_t cpu_num = os::active_processor_count();
...
cpu_to_node()->at_grow(cpu_num - 1);
...
for (size_t k = 0; k < BitsPerCLong; k++) {
if (cpu_map[j] & (1UL << k)) {
cpu_to_node()->at_put(j * BitsPerCLong + k, i);
}
}
On my 32 hw thread machine (2 socket x 8 core x 2 ht) cpu_num becomes 16 when numactl -c 0 is used, and we write outside of the array when K becomes 16.
os::active_processor_count() was changed in build 107 with the changeset for:
JDK-6515172: Runtime.availableProcessors() ignores Linux taskset command
http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/c5480d4abfe4