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

FirestoreImpl initialization needs to be delayed #90

Closed
mar9000 opened this issue Mar 29, 2021 · 6 comments · Fixed by GoogleCloudPlatform/native-image-support-java#109
Assignees
Labels
upsteam Issue on an upsteam library

Comments

@mar9000
Copy link

mar9000 commented Mar 29, 2021

Hi, and thanks for this extension.

With:

  • quarkus 1.12.2.Final
  • google services firestore 0.5.0

I've tested the FirestoreResource on the README.md build a sample project exactly as stated on the same file. It compile to native without problem.

Nevertheless adding these lines (note that the documentId is now generated):

futures.add(persons.document().set(new Person(1L, "John", "Doe")));
futures.add(persons.document().set(new Person(2L, "Jane", "Doe")));
futures.add(persons.document().set(new Person(3L, "Charles", "Baudelaire")));

the native compilation fails with:

Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.security.provider.NativePRNG are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use --trace-object-instantiation=sun.security.provider.NativePRNG.
Detailed message:
Trace: Object was reached by 
	reading field java.security.SecureRandom.secureRandomSpi of
		constant java.security.SecureRandom@701e41f6 reached by 
	scanning method com.google.cloud.firestore.FirestoreImpl.autoId(FirestoreImpl.java:84)
Call path from entry point to com.google.cloud.firestore.FirestoreImpl.autoId(): 
	at com.google.cloud.firestore.FirestoreImpl.autoId(FirestoreImpl.java:81)
	at com.google.cloud.firestore.CollectionReference.document(CollectionReference.java:103)
	at org.acme.resteasyjackson.FirestoreResource.firestore(FirestoreResource.java)

This property solve the problem(see also #67):

quarkus.native.additional-build-args=--initialize-at-run-time=com.google.cloud.firestore.FirestoreImpl

Issue #67 is closed so I decided to reopen a new one.

@loicmathieu
Copy link
Collaborator

@dzou do you think it's something that should be fixed upstream in the native support google cloud library or should I fixed this issue on the Quarkus side (it's easy on the extension side to delay the initialization).

@dzou
Copy link
Collaborator

dzou commented Mar 29, 2021

Ah, thanks for the report.

@loicmathieu - Yes indeed, we will fix this on our end and I will prepare a release for you to use.

@dzou dzou self-assigned this Mar 29, 2021
@loicmathieu loicmathieu added the upsteam Issue on an upsteam library label Mar 29, 2021
@loicmathieu
Copy link
Collaborator

@dzou thanks, I flagged the issue as upstream so we can easily track these kind of issue that should be fixed upstream.

@loicmathieu
Copy link
Collaborator

@dzou thanks for fixing it upstream.

But you was a little too hurry to close this issue as it's not yet available here ;)

I reopen the issue, we'll close it when the upstream fix arrives here (so when a new version of the google-cloud-graalvm-support library is released and integration here).

@loicmathieu loicmathieu reopened this Apr 6, 2021
@dzou
Copy link
Collaborator

dzou commented Apr 6, 2021

Oops, sorry, didn't mean to close it here! I submitted the fix upstream; will do a new release and then upgrade the version in here.

@loicmathieu
Copy link
Collaborator

Fixed via #96

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upsteam Issue on an upsteam library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants