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

Runtime initialize jgit classes using j.u.Random #16017

Merged
merged 1 commit into from
Mar 25, 2021

Conversation

zakkak
Copy link
Contributor

@zakkak zakkak commented Mar 25, 2021

This PR fixes the native integration-test/jgit with Graal VM 21.1-dev due to banned java.util.Random in the image heap as discussed in #14904.

Example failure:

Error: Unsupported features in 2 methods
Detailed message:
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected.  Object has been initialized by the org.eclipse.jgit.internal.storage.file.WindowCache class initializer with a trace: 
 	at java.util.Random.<init>(Random.java:105)
	at org.eclipse.jgit.internal.storage.file.WindowCache.<clinit>(WindowCache.java:336)
. Try avoiding to initialize the class that caused initialization of the object. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: 
	at parsing org.eclipse.jgit.internal.storage.file.WindowCache.evict(WindowCache.java:656)
Call path from entry point to org.eclipse.jgit.internal.storage.file.WindowCache.evict(): 
	at org.eclipse.jgit.internal.storage.file.WindowCache.evict(WindowCache.java:655)
	at org.eclipse.jgit.internal.storage.file.WindowCache.getOrLoad(WindowCache.java:616)
	at org.eclipse.jgit.internal.storage.file.WindowCache.get(WindowCache.java:385)
	at org.eclipse.jgit.internal.storage.file.WindowCursor.pin(WindowCursor.java:327)
	at org.eclipse.jgit.internal.storage.file.WindowCursor.copy(WindowCursor.java:226)
	at org.eclipse.jgit.internal.storage.file.PackInputStream.read(PackInputStream.java:37)
	at com.jcraft.jsch.ChannelForwardedTCPIP.run(ChannelForwardedTCPIP.java:102)
	at java.lang.Thread.run(Thread.java:834)
	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:553)
	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
	at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected.  Object has been initialized by the org.eclipse.jgit.util.FileUtils class initializer with a trace: 
 	at java.util.Random.<init>(Random.java:105)
	at org.eclipse.jgit.util.FileUtils.<clinit>(FileUtils.java:60)
. Try avoiding to initialize the class that caused initialization of the object. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: 
	at parsing org.eclipse.jgit.util.FileUtils.delay(FileUtils.java:1017)
Call path from entry point to org.eclipse.jgit.util.FileUtils.delay(long, long, long): 
	at org.eclipse.jgit.util.FileUtils.delay(FileUtils.java:1014)
	at org.eclipse.jgit.internal.storage.file.FileReftableStack.reload(FileReftableStack.java:261)
	at org.eclipse.jgit.internal.storage.file.FileReftableDatabase.addReftable(FileReftableDatabase.java:337)
	at org.eclipse.jgit.internal.storage.file.FileReftableDatabase.access$2(FileReftableDatabase.java:335)
	at org.eclipse.jgit.internal.storage.file.FileReftableDatabase$FileReftableRefUpdate.doLink(FileReftableDatabase.java:538)
	at org.eclipse.jgit.lib.RefUpdate.link(RefUpdate.java:695)
	at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:210)
	at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:1)
	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.lang.Thread.run(Thread.java:834)
	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:553)
	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
	at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0)

@gsmet gsmet added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Mar 25, 2021
@gastaldi gastaldi merged commit 2be391c into quarkusio:main Mar 25, 2021
@quarkus-bot quarkus-bot bot added this to the 1.14 - main milestone Mar 25, 2021
@zakkak zakkak deleted the jgit-random-reinit branch April 1, 2021 21:50
@gsmet gsmet modified the milestones: 2.0.0.Alpha1, 1.13.4.Final May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/waiting-for-ci Ready to merge when CI successfully finishes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants