Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GR-57950] JVMCI-native CompilerThread0 blocks main thread during the application startup #10155

Open
skyitachi opened this issue Nov 26, 2024 · 3 comments
Assignees
Labels

Comments

@skyitachi
Copy link

Recently, we discovered that there is a probability of the container hanging during startup. Through jstack, we found that the main thread and the JVMCI-native CompilerThread0 thread are experiencing lock contention.

JDK:

java version "21.0.5" 2024-10-15 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 21.0.5+9.1 (build 21.0.5+9-LTS-jvmci-23.1-b48)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.5+9.1 (build 21.0.5+9-LTS-jvmci-23.1-b48, mixed mode, sharing)

OS: custom linux
Architecture: AMD64

jstack output about the two threads:
"main" #1 [94] prio=5 os_prio=0 cpu=112.55ms elapsed=3590.92s tid=0x00007ffb620d1000 nid=94 waiting for monitor entry [0x00007ffb6641c000]
java.lang.Thread.State: BLOCKED (on object monitor)
at java.util.TimeZone.setDefaultZone([email protected]/TimeZone.java:695)
- waiting to lock <0x00000007ff8bd9b0> (a java.lang.Class for java.util.TimeZone)
at java.util.TimeZone.getDefaultRef([email protected]/TimeZone.java:685)
at java.util.TimeZone.getDefault([email protected]/TimeZone.java:674)
at java.util.Calendar.defaultTimeZone([email protected]/Calendar.java:1683)
at java.util.Calendar.getInstance([email protected]/Calendar.java:1663)
at java.text.SimpleDateFormat.initializeCalendar([email protected]/SimpleDateFormat.java:680)
at java.text.SimpleDateFormat.([email protected]/SimpleDateFormat.java:624)
at java.text.SimpleDateFormat.([email protected]/SimpleDateFormat.java:603)
at com.alibaba.ttl.threadpool.agent.internal.logging.Logger$StdErrorLogger.log(Logger.java:68)
at com.alibaba.ttl.threadpool.agent.TtlTransformer.transform(TtlTransformer.java:85)
at java.lang.instrument.ClassFileTransformer.transform([email protected]/ClassFileTransformer.java:244)
at sun.instrument.TransformerManager.transform([email protected]/TransformerManager.java:188)
at sun.instrument.InstrumentationImpl.transform([email protected]/InstrumentationImpl.java:610)
at jdk.internal.loader.URLClassPath.getLoader([email protected]/URLClassPath.java:439)
- locked <0x00000007ff037d98> (a jdk.internal.loader.URLClassPath)
at jdk.internal.loader.URLClassPath.getResource([email protected]/URLClassPath.java:315)
at jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull([email protected]/BuiltinClassLoader.java:757)
at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull([email protected]/BuiltinClassLoader.java:681)
- locked <0x00000007ff1460c0> (a java.lang.Object)
at jdk.internal.loader.BuiltinClassLoader.loadClass([email protected]/BuiltinClassLoader.java:639)
at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass([email protected]/ClassLoaders.java:188)
at java.lang.ClassLoader.loadClass([email protected]/ClassLoader.java:526)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent([email protected]/InstrumentationImpl.java:504)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain([email protected]/InstrumentationImpl.java:572)

Locked ownable synchronizers:
- None

"JVMCI-native CompilerThread0" #14 [107] daemon prio=9 os_prio=0 cpu=22.82ms elapsed=3590.88s tid=0x00007ffb1dcc8000 nid=107 waiting on condition [0x00007ffafbbf9000]
java.lang.Thread.State: RUNNABLE
Compiling: 223 4 java.lang.String::hashCode (60 bytes)
at java.security.CodeSource.([email protected]/CodeSource.java:123)
at jdk.internal.loader.BuiltinClassLoader.defineClass([email protected]/BuiltinClassLoader.java:818)
at jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull([email protected]/BuiltinClassLoader.java:741)
at jdk.internal.loader.BuiltinClassLoader.findClass([email protected]/BuiltinClassLoader.java:621)
at java.lang.ClassLoader.loadClass([email protected]/ClassLoader.java:638)
- locked <0x00000007fe07bed0> (a java.lang.Object)
at java.lang.Class.forName([email protected]/Class.java:625)
at java.lang.Class.forName([email protected]/Class.java:600)
at java.util.ServiceLoader.loadProvider([email protected]/ServiceLoader.java:859)
at java.util.ServiceLoader$ModuleServicesLookupIterator.hasNext([email protected]/ServiceLoader.java:1084)
at java.util.ServiceLoader$2.hasNext([email protected]/ServiceLoader.java:1309)
at java.util.ServiceLoader$3.hasNext([email protected]/ServiceLoader.java:1393)
at sun.util.cldr.CLDRLocaleProviderAdapter.lambda$new$0([email protected]/CLDRLocaleProviderAdapter.java:84)
at sun.util.cldr.CLDRLocaleProviderAdapter$$Lambda/0x800000063.run([email protected]/Unknown Source)
at java.security.AccessController.executePrivileged([email protected]/AccessController.java:809)
at java.security.AccessController.doPrivileged([email protected]/AccessController.java:571)
at sun.util.cldr.CLDRLocaleProviderAdapter.([email protected]/CLDRLocaleProviderAdapter.java:83)
at java.lang.invoke.DirectMethodHandle$Holder.newInvokeSpecial([email protected]/DirectMethodHandle$Holder)
at java.lang.invoke.Invokers$Holder.invokeExact_MT([email protected]/Invokers$Holder)
at jdk.internal.reflect.DirectConstructorHandleAccessor.invokeImpl([email protected]/DirectConstructorHandleAccessor.java:86)
at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance([email protected]/DirectConstructorHandleAccessor.java:62)
at java.lang.reflect.Constructor.newInstanceWithCaller([email protected]/Constructor.java:502)
at java.lang.reflect.Constructor.newInstance([email protected]/Constructor.java:486)
at sun.util.locale.provider.LocaleProviderAdapter.forType([email protected]/LocaleProviderAdapter.java:194)
at sun.util.locale.provider.LocaleProviderAdapter.findAdapter([email protected]/LocaleProviderAdapter.java:293)
at sun.util.locale.provider.LocaleProviderAdapter.getAdapter([email protected]/LocaleProviderAdapter.java:264)
at java.util.Calendar.createCalendar([email protected]/Calendar.java:1696)
at java.util.Calendar.getInstance([email protected]/Calendar.java:1663)
at java.text.SimpleDateFormat.initializeCalendar([email protected]/SimpleDateFormat.java:680)
at java.text.SimpleDateFormat.([email protected]/SimpleDateFormat.java:624)
at java.text.SimpleDateFormat.([email protected]/SimpleDateFormat.java:603)
at com.alibaba.ttl.threadpool.agent.internal.logging.Logger$StdErrorLogger.log(Logger.java:68)
at com.alibaba.ttl.threadpool.agent.TtlTransformer.transform(TtlTransformer.java:85)
at java.lang.instrument.ClassFileTransformer.transform([email protected]/ClassFileTransformer.java:244)
at sun.instrument.TransformerManager.transform([email protected]/TransformerManager.java:188)
at sun.instrument.InstrumentationImpl.transform([email protected]/InstrumentationImpl.java:610)
at java.io.FileInputStream.close([email protected]/FileInputStream.java:524)
at java.io.BufferedInputStream.close([email protected]/BufferedInputStream.java:618)
at java.io.FilterInputStream.close([email protected]/FilterInputStream.java:170)
at sun.util.calendar.ZoneInfoFile$1.run([email protected]/ZoneInfoFile.java:268)
at sun.util.calendar.ZoneInfoFile$1.run([email protected]/ZoneInfoFile.java:260)
at java.security.AccessController.executePrivileged([email protected]/AccessController.java:778)
at java.security.AccessController.doPrivileged([email protected]/AccessController.java:319)
at sun.util.calendar.ZoneInfoFile.loadTZDB([email protected]/ZoneInfoFile.java:260)
at sun.util.calendar.ZoneInfoFile.([email protected]/ZoneInfoFile.java:255)
at sun.util.calendar.ZoneInfo.getTimeZone([email protected]/ZoneInfo.java:574)
at java.util.TimeZone.getTimeZone([email protected]/TimeZone.java:609)
at java.util.TimeZone.setDefaultZone([email protected]/TimeZone.java:709)
- locked <0x00000007ff8bd9b0> (a java.lang.Class for java.util.TimeZone)
at java.util.TimeZone.getDefaultRef([email protected]/TimeZone.java:685)
at java.util.Date.normalize([email protected]/Date.java:1197)
at java.util.Date.toString([email protected]/Date.java:1030)
at java.lang.String.valueOf([email protected]/String.java:4465)
at java.lang.StringBuilder.append([email protected]/StringBuilder.java:173)
at java.util.Properties.writeDateComment([email protected]/Properties.java:958)
at java.util.Properties.store0([email protected]/Properties.java:919)
at java.util.Properties.store([email protected]/Properties.java:908)
at jdk.internal.vm.VMSupport.serializePropertiesToByteArray([email protected]/VMSupport.java:77)
at jdk.internal.vm.VMSupport.serializeSavedPropertiesToByteArray([email protected]/VMSupport.java:115)

Locked ownable synchronizers:
- None

as the jstack output, main thread wait on lock 0x00000007ff8bd9b0, which alread acquired by JVMCI-native CompilerThread0, it's very weird the jvmci-native compilterthread0 compiling the java.lang.String::hashCode but never stop.

We are currently using Graal JIT in a production environment, and the probability of this issue occurring is not small. If it cannot be resolved, it will affect our use of Graal JIT. If there are any solutions, we hope to be informed promptly. Thanks.

ps: full jstack out
jstack.log

@skyitachi skyitachi added the bug label Nov 26, 2024
@selhagani selhagani self-assigned this Nov 26, 2024
@selhagani
Copy link
Member

Hi @skyitachi, thank you for reaching out to us about this.

Could you please try running your application with following flag: -XX:-UseJVMCICompiler ? let me know if using it solves your issue.

@skyitachi
Copy link
Author

Firstly, thanks for your reply @selhagani , we already have other app servers running with normal jdk21 version(no graal jit), and they are running smoothly. The problem itself cannot be reproduced steadily, we are still collecting the cases.

I wonder why JVMCI-native CompilerThread0 need to wait on condition while compiling.

"JVMCI-native CompilerThread0" #14 [107] daemon prio=9 os_prio=0 cpu=22.82ms elapsed=3590.88s tid=0x00007ffb1dcc8000 nid=107 waiting on condition [0x00007ffafbbf9000]
java.lang.Thread.State: RUNNABLE
Compiling: 223 4 java.lang.String::hashCode (60 bytes)
at java.security.CodeSource.([email protected]/CodeSource.java:123)
the thread was blocked due to compiling hashCode method or at java.security.CodeSource.<init>([email protected]/CodeSource.java:123)

@skyitachi
Copy link
Author

another case today, main thread and JVMCI-native CompilerThread0 waiting on different conditions and all stucked.

full jstack thread dump.txt

@selhagani selhagani changed the title JVMCI-native CompilerThread0 blocks main thread during the application startup [GR-60124] JVMCI-native CompilerThread0 blocks main thread during the application startup Nov 27, 2024
@selhagani selhagani changed the title [GR-60124] JVMCI-native CompilerThread0 blocks main thread during the application startup [GR-57950] JVMCI-native CompilerThread0 blocks main thread during the application startup Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants