The following code can reproduce the problem, writing out of bounds causes JVM Crash
StringBuilder buf = new StringBuilder();
buf.append('δΈ');
final CountDownLatch latch = new CountDownLatch(10);
Runnable r = () -> {
for (int i = 0; i < 10000; i++) {
buf.setLength(0);
buf.trimToSize();
buf.append(123456789);
}
latch.countDown();
};
Thread[] threads = new Thread[10];
for (int i = 0; i < threads.length; i++) {
threads[i] = new Thread(r);
}
for (Thread t : threads) {
t.start();
}
latch.await();
}
StringBuilder buf = new StringBuilder();
buf.append('δΈ');
final CountDownLatch latch = new CountDownLatch(10);
Runnable r = () -> {
for (int i = 0; i < 10000; i++) {
buf.setLength(0);
buf.trimToSize();
buf.append(123456789);
}
latch.countDown();
};
Thread[] threads = new Thread[10];
for (int i = 0; i < threads.length; i++) {
threads[i] = new Thread(r);
}
for (Thread t : threads) {
t.start();
}
latch.await();
}
- caused by
-
JDK-8343962 [REDO] Move getChars to DecimalDigits
-
- Resolved
-
- links to
-
Review(master) openjdk/jdk/23427