-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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-40565] Watchdog detects no activity during classpath scanning and kills the process #4822
Comments
What was your working directory and how many subfolders does it contain? Native Image scans all the folders in the current working directory to find classes that should be on the classpath. If this folder is large, especially on network drives, this can take some time. This behavior is going to change in the future, but it requires significant changes to the image builder. |
I checked it just now, there are many files under my folder, and then I created a new empty folder for testing and found that it works, thank you for your help |
By the way, what should I do if my project file is very large and there are too many, I can only wait for you to optimize it? |
How many files are in question? This should only happen if you pull in large parts of your file system. |
We certainly need to handle this better:
|
Is there any solution for this issue, if we have large amount of Java classes? I have mid-sized Micronaut project but it fails with same exception as mentioned in this thread while trying to build native image, and I have no idea how to build it now. |
If it is a regular project, the classpath scanning should not be a problem. Can you share a reproducer? |
Thanks for the very quick response. It is a Micronaut project for AWS Lambda. Unfortunately I would not be able to share the source code as it is confidential. But is the above error related to many classes there on the classpath (in the folder where we are building it)? Below are the dependencies in my
And below are the arguments which are passed to build native image (mentioned in
And here is the command which I use to build native image for AWS Lambda - Above command generates below Dockerfile:
And it fails while running |
I have posted question on StackOverflow with some more details about the issue I am facing - https://stackoverflow.com/questions/73935636/micronaut-graalvm-issue-in-building-graalvm-native-image-for-micronaut-applica |
@vjovanov @fniephaus Do we have any fix/solution for this issue? This is a major blocker for me. |
A fix for this just landed in master (see #5112) but that's unfortunately not going to make it into 22.3. But you should be able to use a 23.0 dev build very soon. |
Environment:
macos
openjdk version "11.0.16" 2022-07-19
OpenJDK Runtime Environment GraalVM CE 22.2.0 (build 11.0.16+8-jvmci-22.2-b06)
OpenJDK 64-Bit Server VM GraalVM CE 22.2.0 (build 11.0.16+8-jvmci-22.2-b06, mixed mode, sharing)
Q:I wrote a HellWorld test class for local compilation and testing, but the following error occurred
ps:I used the graalVM 21+ version at first, and this problem also occurred at that time. Later, I found a similar problem in the issue(#2283, and the description has been solved. Later, I upgraded the graalVM version, but the problem still exists.
cmd:native-image HelloWorld
WARNING: Unknown module: org.graalvm.nativeimage.llvm specified to --add-exports
WARNING: Unknown module: org.graalvm.nativeimage.llvm specified to --add-exports
WARNING: Unknown module: org.graalvm.nativeimage.llvm specified to --add-exports
GraalVM Native Image: Generating 'helloworld' (executable)...
[1/7] Initializing... (46.3s @ 0.10GB)
Version info: 'GraalVM 22.2.0 Java 11 CE'
Java version info: '11.0.16+8-jvmci-22.2-b06'
C compiler: cc (apple, x86_64, 13.1.6)
Garbage collector: Serial GC
=== Image generator watchdog detected no activity. This can be a sign of a deadlock during image building. Dumping all stack traces. Current time: Wed Aug 17 14:22:27 CST 2022
"main" Id=1 in RUNNABLE
at java.base@11.0.16/java.nio.file.Files$2.hasNext(Files.java:3708)
at java.base@11.0.16/java.util.Iterator.forEachRemaining(Iterator.java:132)
at java.base@11.0.16/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.base@11.0.16/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ClassLoaderSupportImpl.scanDirectory(ClassLoaderSupportImpl.java:168)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ClassLoaderSupportImpl.collectResources(ClassLoaderSupportImpl.java:109)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ResourcesFeature.duringAnalysis(ResourcesFeature.java:266)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$10(NativeImageGenerator.java:734)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator$$Lambda$827/0x00000007c0e76040.accept(Unknown Source)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:78)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$11(NativeImageGenerator.java:734)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator$$Lambda$521/0x00000007c0d88c40.apply(Unknown Source)
at app/org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.PointsToAnalysis.runAnalysis(PointsToAnalysis.java:755)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:731)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:564)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:521)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:407)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
"Reference Handler" Id=2 in RUNNABLE
at java.base@11.0.16/java.lang.ref.Reference.waitForReferencePendingList(Native Method)
at java.base@11.0.16/java.lang.ref.Reference.processPendingReferences(Reference.java:241)
at java.base@11.0.16/java.lang.ref.Reference$ReferenceHandler.run(Reference.java:213)
"Finalizer" Id=3 in WAITING on lock=java.lang.ref.ReferenceQueue$Lock@4dd3b6c7
at java.base@11.0.16/java.lang.Object.wait(Native Method)
at java.base@11.0.16/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155)
at java.base@11.0.16/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:176)
at java.base@11.0.16/java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:170)
"Signal Dispatcher" Id=4 in RUNNABLE
"JVMCI-native CompilerThread0" Id=6 in RUNNABLE
"Common-Cleaner" Id=9 in TIMED_WAITING on lock=java.lang.ref.ReferenceQueue$Lock@4e2fab8e
at java.base@11.0.16/java.lang.Object.wait(Native Method)
at java.base@11.0.16/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155)
at java.base@11.0.16/jdk.internal.ref.CleanerImpl.run(CleanerImpl.java:148)
at java.base@11.0.16/java.lang.Thread.run(Thread.java:829)
at java.base@11.0.16/jdk.internal.misc.InnocuousThread.run(InnocuousThread.java:161)
"Thread-1" Id=19 in RUNNABLE
at java.management@11.0.16/sun.management.ThreadImpl.dumpThreads0(Native Method)
at java.management@11.0.16/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:521)
at java.management@11.0.16/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:509)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.DeadlockWatchdog.threadDump(DeadlockWatchdog.java:113)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.DeadlockWatchdog.watchdogThread(DeadlockWatchdog.java:80)
at app/org.graalvm.nativeimage.builder/com.oracle.svm.hosted.DeadlockWatchdog$$Lambda$179/0x00000007c0287440.run(Unknown Source)
at java.base@11.0.16/java.lang.Thread.run(Thread.java:829)
"ForkJoinPool-4-worker-3" Id=25 in WAITING on lock=java.util.concurrent.ForkJoinPool@350cf2c7
at java.base@11.0.16/jdk.internal.misc.Unsafe.park(Native Method)
at java.base@11.0.16/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
at java.base@11.0.16/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1628)
at java.base@11.0.16/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
"ForkJoinPool-2-worker-13" Id=38 in WAITING on lock=java.util.concurrent.ForkJoinPool@1f354e7c
at java.base@11.0.16/jdk.internal.misc.Unsafe.park(Native Method)
at java.base@11.0.16/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
at java.base@11.0.16/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1628)
at java.base@11.0.16/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
=== Memory statistics (in MB):
=== Used heap size: 12376
=== Free heap size: 3632
=== Maximum heap size: 12376
=== Image generator watchdog is aborting image generation. To configure the watchdog, use the options -H:DeadlockWatchdogInterval=10 and -H:+DeadlockWatchdogExitOnTimeout
Error: Image build request failed with exit status 1
how do I fix it
The text was updated successfully, but these errors were encountered: