JDK-8269137 : Division by zero in TieredThresholdPolicy::threshold_scale
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11.0.10
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2021-06-08
  • Updated: 2025-07-01
  • Resolved: 2025-07-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE PROBLEM :
Running make images to build java in tieredThresholdPolicy.cpp line 562

double k = queue_size / (feedback_k * comp_count) + 1;

comp_count is zero, thus attempting a division by zero.
I put an assert to double check.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
make JOBS=1 images
Building target 'images' in configuration '/home/vitti/rpmbuild/SOURCES/openjdk/build-clang'
Updating support/modules_libs/java.base/server/libjvm.so due to 1 file(s)
Creating support/interim-jmods/java.base.jmod
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/tieredThresholdPolicy.cpp:563
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/vitti/rpmbuild/SOURCES/openjdk/src/hotspot/share/runtime/tieredThresholdPolicy.cpp:563), pid=1364948, tid=1364951
#  assert(comp_count != 0) failed: comp_count==0 in TieredThresholdPolicy::threshold_scale in tieredThresholdPolicy.cpp 
#
# JRE version: OpenJDK Runtime Environment (11.0.10) (fastdebug build 11.0.10-internal+0-adhoc.vitti.openjdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 11.0.10-internal+0-adhoc.vitti.openjdk, mixed mode, tiered, compressed oops, serial gc, linux-amd64)
# Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" (or dumping to /home/vitti/rpmbuild/SOURCES/openjdk/make/core.1364948)
#
# An error report file with more information is saved as:
# /home/vitti/rpmbuild/SOURCES/openjdk/make/hs_err_pid1364948.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#
Current thread is 1364951
Dumping core ...
/usr/bin/bash: line 1: 1364948 Aborted                 (core dumped) /home/vitti/rpmbuild/SOURCES/openjdk/build-clang/jdk/bin/jmod -J-XX:+UseSerialGC -J-Xms32M -J-Xmx512M -J-XX:TieredStopAtLevel=1 create --module-version 11.0.10-internal --target-platform 'linux-amd64' --module-path /home/vitti/rpmbuild/SOURCES/openjdk/build-clang/support/interim-jmods --libs /home/vitti/rpmbuild/SOURCES/openjdk/build-clang/support/modules_libs/java.base --cmds /home/vitti/rpmbuild/SOURCES/openjdk/build-clang/support/modules_cmds/java.base --config /home/vitti/rpmbuild/SOURCES/openjdk/build-clang/support/modules_conf/java.base --class-path /home/vitti/rpmbuild/SOURCES/openjdk/build-clang/jdk/modules/java.base --header-files /home/vitti/rpmbuild/SOURCES/openjdk/build-clang/support/modules_include/java.base --legal-notices "/home/vitti/rpmbuild/SOURCES/openjdk/build-clang/support/modules_legal/common:/home/vitti/rpmbuild/SOURCES/openjdk/build-clang/support/modules_legal/java.base" --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM}' /home/vitti/rpmbuild/SOURCES/openjdk/build-clang/support/interim-jmods/temp/java.base.jmod > >(/usr/bin/tee -a /home/vitti/rpmbuild/SOURCES/openjdk/build-clang/support/jmods/java.base.jmod.log) 2> >(/usr/bin/tee -a /home/vitti/rpmbuild/SOURCES/openjdk/build-clang/support/jmods/java.base.jmod.log >&2)
gmake[3]: *** [CreateJmods.gmk:220: /home/vitti/rpmbuild/SOURCES/openjdk/build-clang/support/interim-jmods/java.base.jmod] Error 134
gmake[2]: *** [make/Main.gmk:501: java.base-interim-jmod] Error 2

ERROR: Build failed for target 'images' in configuration '/home/vitti/rpmbuild/SOURCES/openjdk/build-clang' (exit code 2) 

=== Output from failing command(s) repeated here ===
* For target support_jmods_java.base.jmod:
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/tieredThresholdPolicy.cpp:563
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/vitti/rpmbuild/SOURCES/openjdk/src/hotspot/share/runtime/tieredThresholdPolicy.cpp:563), pid=1364948, tid=1364951
#  assert(comp_count != 0) failed: comp_count==0 in TieredThresholdPolicy::threshold_scale in tieredThresholdPolicy.cpp 
#
# JRE version: OpenJDK Runtime Environment (11.0.10) (fastdebug build 11.0.10-internal+0-adhoc.vitti.openjdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 11.0.10-internal+0-adhoc.vitti.openjdk, mixed mode, tiered, compressed oops, serial gc, linux-amd64)
# Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" (or dumping to /home/vitti/rpmbuild/SOURCES/openjdk/make/core.1364948)
#
# An error report file with more information is saved as:
# /home/vitti/rpmbuild/SOURCES/openjdk/make/hs_err_pid1364948.log
#
   ... (rest of output omitted)

* All command lines available in /home/vitti/rpmbuild/SOURCES/openjdk/build-clang/make-support/failure-logs.
=== End of repeated output ===

No indication of failed target found.
Hint: Try searching the build log for '] Error'.
Hint: See doc/building.html#troubleshooting for assistance.

make[1]: *** [/home/vitti/rpmbuild/SOURCES/openjdk/make/Init.gmk:305: main] Error 2
make: *** [/home/vitti/rpmbuild/SOURCES/openjdk/make/Init.gmk:186: images] Error 2

#-----------------------------------------------------------#

Comments
JDK-8353815 provides a solution for this on mainline.
01-07-2025

ILW = potential build failure, no reproducer yet, no workaround = MLH = P4
23-06-2021

SimpleThresholdPolicy was renamed to TieredThresholdPolicy in https://bugs.openjdk.java.net/browse/JDK-8209186 Moving it to JDK for further analysis.
22-06-2021

There is no file called in "tieredThresholdPolicy.cpp" in jdk repo. I found compilationPolicy.cpp file that has the change that is in question here. double k = queue_size / (feedback_k * comp_count) + 1; This change was added as part of https://bugs.openjdk.java.net/browse/JDK-8251462 which never made to OpenJDK11, so submitter need to contact the vendor from whom he has received the jdk. But the change is part of mainline jdk. It is worth investigation the scenario that can cause division by zero issue.
18-06-2021