-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
As recommended in the configuration section, I call as early as possible, in my application main entry point, com.amazon.corretto.crypto.provider.AmazonCorrettoCryptoProvider.install()
.
But, if I then use --initialize-at-build-time
with GraalVM's native-image
, it complains that a java.lang.Thread
is created as a side-effect of calling install()
.
Error: Detected a started Thread in the image heap. Threads running in the image generator are no longer running at image
runtime. To see how this object got instantiated use --trace-object-instantiation=java.lang.Thread. 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: Object was reached by
reading field java.util.concurrent.locks.AbstractOwnableSynchronizer.exclusiveOwnerThread of
constant java.util.concurrent.locks.ReentrantLock$NonfairSync@78f11bbf reached by
reading field java.util.concurrent.locks.ReentrantLock.sync of
constant java.util.concurrent.locks.ReentrantLock@6bf37934 reached by
reading field com.amazon.corretto.crypto.provider.Janitor$Stripe.queueLock of
constant com.amazon.corretto.crypto.provider.Janitor$Stripe@7b88490d reached by
indexing into array
constant com.amazon.corretto.crypto.provider.Janitor$Stripe[]@7c5f1b50 reached by
reading field com.amazon.corretto.crypto.provider.Janitor$JanitorState.stripes of
constant com.amazon.corretto.crypto.provider.Janitor$JanitorState@38cbe7ef reached by
scanning method com.amazon.corretto.crypto.provider.Janitor.register(Janitor.java:50)
The cascade of class initializations goes as follows
install()
is called onAmazonCorrettoCryptoProvider
...- ... which loads
com.amazon.corretto.crypto.provider.Loader
atAmazonCorrettoCryptoProvider:47
(v 1.6.1)static { if (!Loader.IS_AVAILABLE) {
- ... which loads
Janitor
atLoader:185
// Finally start up a cleaning thread if necessary RESOURCE_JANITOR = new Janitor();
- ... which starts a cleaner thread at
Janitor:319
Is there a way to initialize as much as possible of the provider without creating this thread?
Amazon started adding GraalVM configuration files in SDK libraries. Maybe it's time to do the same for AmazonCorrettoCryptoProvider
. In any case, any advice is welcome.
msailes and jzhn
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed