RFR: 8349241: Fix the concurrent execution JVM crash of StringBuilder::append(int/long) [v4]
Thomas Stuefe
stuefe at openjdk.org
Tue Feb 4 14:03:24 UTC 2025
On Tue, 4 Feb 2025 13:43:08 GMT, Shaojin Wen <swen at openjdk.org> wrote:
>> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
>>
>> skip coder change
>
>> ```java
>> 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();
>> ```
>
> Will cause the JVM to exit directly, the error message is as follows
>
> #
> # A fatal error has been detected by the Java Runtime Environment:
> #
> # SIGBUS (0xa) at pc=0x0000000103b9d23c, pid=23348, tid=33539
> #
> # JRE version: OpenJDK Runtime Environment (25.0) (build 25-internal-adhoc.wenshao.jdkx)
> # Java VM: OpenJDK 64-Bit Server VM (25-internal-adhoc.wenshao.jdkx, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
> # Problematic frame:
> # [thread 41731 also had an error]
> V [libjvm.dylib+0x41523c] G1ParScanThreadState::copy_to_survivor_space(G1HeapRegionAttr, oopDesc*, markWord)+0x64
> #
> # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
> #
> [thread 39683 also had an error]
> # An error report file with more information is saved as:
> # /Users/wenshao/Work/git/jdk_mico_bench/hs_err_pid23348.log
> #
> # If you would like to submit a bug report, please visit:
> # https://bugreport.java.com/bugreport/crash.jsp
> #
@wenshao Thank you. This seems to be a GC problem. I adjusted the JBS issue accordingly. You set this to "24" as affected version, but if this is a mainline issue, please add 25 and if possible all other versions this occurs in. If possible, please attach an hs-err file or at least the crash stack.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23427#issuecomment-2634056307
More information about the core-libs-dev
mailing list