-
Type:
Bug
-
Resolution: Not an Issue
-
Priority:
P3
-
None
-
Affects Version/s: 21.0.9, 25
-
Component/s: hotspot
-
generic
ADDITIONAL SYSTEM INFORMATION :
Property settings:
file.encoding = UTF-8
file.separator = /
java.class.path =
java.class.version = 65.0
java.home = /root/hotspot-21/build/linux-x86_64-server-release/jdk
java.io.tmpdir = /tmp
java.library.path = /usr/java/packages/lib
/usr/lib64
/lib64
/lib
/usr/lib
java.runtime.name = OpenJDK Runtime Environment
java.runtime.version = 21.0.10-internal-adhoc.root.hotspot-21
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 21
java.vendor = N/A
java.vendor.url = https://openjdk.org/
java.vendor.url.bug = https://bugreport.java.com/bugreport/
java.version = 21.0.10-internal
java.version.date = 2026-01-20
java.vm.compressedOopsMode = Zero based
java.vm.info = mixed mode
java.vm.name = OpenJDK 64-Bit Server VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.version = 21
java.vm.vendor = Oracle Corporation
java.vm.version = 21.0.10-internal-adhoc.root.hotspot-21
jdk.debug = release
line.separator = \n
native.encoding = ANSI_X3.4-1968
os.arch = amd64
os.name = Linux
os.version = 5.15.0-60-generic
path.separator = :
stderr.encoding = ANSI_X3.4-1968
stdout.encoding = ANSI_X3.4-1968
sun.arch.data.model = 64
sun.boot.library.path = /root/hotspot-21/build/linux-x86_64-server-release/jdk/lib
sun.cpu.endian = little
sun.io.unicode.encoding = UnicodeLittle
sun.java.launcher = SUN_STANDARD
sun.jnu.encoding = ANSI_X3.4-1968
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
user.country = US
user.home = /root
user.language = en
user.name = root
openjdk version "21.0.10-internal" 2026-01-20
OpenJDK Runtime Environment (build 21.0.10-internal-adhoc.root.hotspot-21)
OpenJDK 64-Bit Server VM (build 21.0.10-internal-adhoc.root.hotspot-21, mixed mode)
A DESCRIPTION OF THE PROBLEM :
When terminating a thread executing a tight infinite loop using `Thread.stop()`, JDK 21 will timeout (>60s), while other LTS versions (8, 11, 17) exit quickly (~0.2s).
I investigated the behavior using `-XX:+UnlockDiagnosticVMOptions -XX:+PrintCompilation`.
+ JDK 17: The logs show no "idle" related operations during execution.
+ JDK 21: The logs indicate the presence of OSR (On-Stack Replacement) compilation associated with "idle" operations, which appears to be the cause of the delay/hang.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
```
javac Test.java
java Test
```
---------- BEGIN SOURCE ----------
```
public class Test {
static long counter = 0;
static void idle() {
while (true) {
counter++;
}
}
public static void main(String[] args) throws Exception {
Thread worker = new Thread(() -> {
try {
idle();
} catch (Throwable t) {
}
}, "worker");
worker.start();
worker.stop();
}
}
```
---------- END SOURCE ----------
FREQUENCY :
ALWAYS
Property settings:
file.encoding = UTF-8
file.separator = /
java.class.path =
java.class.version = 65.0
java.home = /root/hotspot-21/build/linux-x86_64-server-release/jdk
java.io.tmpdir = /tmp
java.library.path = /usr/java/packages/lib
/usr/lib64
/lib64
/lib
/usr/lib
java.runtime.name = OpenJDK Runtime Environment
java.runtime.version = 21.0.10-internal-adhoc.root.hotspot-21
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 21
java.vendor = N/A
java.vendor.url = https://openjdk.org/
java.vendor.url.bug = https://bugreport.java.com/bugreport/
java.version = 21.0.10-internal
java.version.date = 2026-01-20
java.vm.compressedOopsMode = Zero based
java.vm.info = mixed mode
java.vm.name = OpenJDK 64-Bit Server VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.version = 21
java.vm.vendor = Oracle Corporation
java.vm.version = 21.0.10-internal-adhoc.root.hotspot-21
jdk.debug = release
line.separator = \n
native.encoding = ANSI_X3.4-1968
os.arch = amd64
os.name = Linux
os.version = 5.15.0-60-generic
path.separator = :
stderr.encoding = ANSI_X3.4-1968
stdout.encoding = ANSI_X3.4-1968
sun.arch.data.model = 64
sun.boot.library.path = /root/hotspot-21/build/linux-x86_64-server-release/jdk/lib
sun.cpu.endian = little
sun.io.unicode.encoding = UnicodeLittle
sun.java.launcher = SUN_STANDARD
sun.jnu.encoding = ANSI_X3.4-1968
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
user.country = US
user.home = /root
user.language = en
user.name = root
openjdk version "21.0.10-internal" 2026-01-20
OpenJDK Runtime Environment (build 21.0.10-internal-adhoc.root.hotspot-21)
OpenJDK 64-Bit Server VM (build 21.0.10-internal-adhoc.root.hotspot-21, mixed mode)
A DESCRIPTION OF THE PROBLEM :
When terminating a thread executing a tight infinite loop using `Thread.stop()`, JDK 21 will timeout (>60s), while other LTS versions (8, 11, 17) exit quickly (~0.2s).
I investigated the behavior using `-XX:+UnlockDiagnosticVMOptions -XX:+PrintCompilation`.
+ JDK 17: The logs show no "idle" related operations during execution.
+ JDK 21: The logs indicate the presence of OSR (On-Stack Replacement) compilation associated with "idle" operations, which appears to be the cause of the delay/hang.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
```
javac Test.java
java Test
```
---------- BEGIN SOURCE ----------
```
public class Test {
static long counter = 0;
static void idle() {
while (true) {
counter++;
}
}
public static void main(String[] args) throws Exception {
Thread worker = new Thread(() -> {
try {
idle();
} catch (Throwable t) {
}
}, "worker");
worker.start();
worker.stop();
}
}
```
---------- END SOURCE ----------
FREQUENCY :
ALWAYS