firebase / firebase-admin-java

Firebase Admin Java SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
540 stars 267 forks source link

Cloud firestore data retrieving doesn't work anymore after packaging my java application (MacOS) #499

Open thboulay opened 3 years ago

thboulay commented 3 years ago

Environment : MacOS, Java JDK : jdk-14.0.1.jdk (Maven project) Firebase Admin SDK : com.google.firebase:firebase-admin:jar:7.0.1

Problem : When I try to retrieve data with firestore, it works great as long as the application is not packaged. But when I package the application (on MacOS only, to .app or to .dmg), the application doesn't reach to retrieve the data. The firebase connection work and I get the firestore database which isn't null, but when I use the 'get()' method to retrieve the data, it loops and causes a timeout.

Step to reproduce : I create a project to reproduce : [https://github.com/thboulay/JavaFirestorePackage]

Difference between before and after package : When I run the project AFTER packaging, I get the following error (if I run it before packaging, with Intellij for example, no error and no problem to retrieve the data) : Dec 02, 2020 10:09:37 AM io.grpc.netty.shaded.io.netty.channel.DefaultChannelId defaultProcessId WARNING: Failed to find the current process ID from ''; using a random value: -1254263216 Error when trying to start firebase java.util.concurrent.ExecutionException: com.google.api.gax.rpc.DeadlineExceededException: io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: deadline exceeded after 49.985915988s. [buffered_nanos=295866600, buffered_nanos=49697872776, waiting_for_connection] at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:564) at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:545) at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:86) at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:62) at com.thboulay.FirebaseTest.start(FirebaseTest.java:45) at com.thboulay.JavaFirestorePackage.main(JavaFirestorePackage.java:8) Caused by: com.google.api.gax.rpc.DeadlineExceededException: io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: deadline exceeded after 49.985915988s. [buffered_nanos=295866600, buffered_nanos=49697872776, waiting_for_connection] at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:51) at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72) at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:60) at com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:97) at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:68) at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1050) at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30) at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1176) at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:969) at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:760) at io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:545) at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:515) at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426) at io.grpc.internal.ClientCallImpl.access$500(ClientCallImpl.java:66) at io.grpc.internal.ClientCallImpl$1CloseInContext.runInContext(ClientCallImpl.java:416) at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) Caused by: io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: deadline exceeded after 49.985915988s. [buffered_nanos=295866600, buffered_nanos=49697872776, waiting_for_connection] at io.grpc.Status.asRuntimeException(Status.java:533)

Dependencies : com.google.firebase:firebase-admin:jar:7.0.1 already exists in destination. com.google.api-client:google-api-client:jar:1.30.10 already exists in destination. com.google.oauth-client:google-oauth-client:jar:1.31.0 already exists in destination. com.google.http-client:google-http-client-jackson2:jar:1.36.0 already exists in destination. com.google.api-client:google-api-client-gson:jar:1.30.10 already exists in destination. com.google.http-client:google-http-client-gson:jar:1.36.0 already exists in destination. com.google.http-client:google-http-client:jar:1.35.0 already exists in destination. org.apache.httpcomponents:httpclient:jar:4.5.12 already exists in destination. org.apache.httpcomponents:httpcore:jar:4.4.13 already exists in destination. com.google.code.findbugs:jsr305:jar:3.0.2 already exists in destination. com.google.j2objc:j2objc-annotations:jar:1.3 already exists in destination. io.opencensus:opencensus-api:jar:0.24.0 already exists in destination. io.opencensus:opencensus-contrib-http-util:jar:0.24.0 already exists in destination. com.google.api:api-common:jar:1.9.2 already exists in destination. javax.annotation:javax.annotation-api:jar:1.3.2 already exists in destination. com.google.auto.value:auto-value-annotations:jar:1.7.2 already exists in destination. com.google.auth:google-auth-library-oauth2-http:jar:0.20.0 already exists in destination. com.google.auth:google-auth-library-credentials:jar:0.20.0 already exists in destination. com.google.cloud:google-cloud-storage:jar:1.110.0 already exists in destination. com.google.guava:failureaccess:jar:1.0.1 already exists in destination. com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava already exists in destination. org.checkerframework:checker-compat-qual:jar:2.5.5 already exists in destination. com.google.errorprone:error_prone_annotations:jar:2.3.4 already exists in destination. com.fasterxml.jackson.core:jackson-core:jar:2.11.0 already exists in destination. com.google.apis:google-api-services-storage:jar:v1-rev20200430-1.30.9 already exists in destination. com.google.code.gson:gson:jar:2.8.6 already exists in destination. com.google.cloud:google-cloud-core:jar:1.93.6 already exists in destination. com.google.api.grpc:proto-google-common-protos:jar:1.18.0 already exists in destination. com.google.cloud:google-cloud-core-http:jar:1.93.6 already exists in destination. com.google.http-client:google-http-client-appengine:jar:1.35.0 already exists in destination. com.google.api:gax-httpjson:jar:0.74.0 already exists in destination. com.google.api:gax:jar:1.57.0 already exists in destination. io.grpc:grpc-context:jar:1.30.0 already exists in destination. com.google.api.grpc:proto-google-iam-v1:jar:0.13.0 already exists in destination. com.google.protobuf:protobuf-java:jar:3.12.2 already exists in destination. com.google.protobuf:protobuf-java-util:jar:3.12.2 already exists in destination. org.threeten:threetenbp:jar:1.4.4 already exists in destination. com.google.cloud:google-cloud-firestore:jar:1.35.0 already exists in destination. com.google.cloud:google-cloud-core-grpc:jar:1.93.6 already exists in destination. io.grpc:grpc-core:jar:1.30.0 already exists in destination. com.google.android:annotations:jar:4.1.1.4 already exists in destination. io.perfmark:perfmark-api:jar:0.19.0 already exists in destination. commons-logging:commons-logging:jar:1.2 already exists in destination. commons-codec:commons-codec:jar:1.11 already exists in destination. com.google.api.grpc:proto-google-cloud-firestore-admin-v1:jar:1.35.0 already exists in destination. com.google.api.grpc:proto-google-cloud-firestore-v1:jar:1.35.0 already exists in destination. com.google.api.grpc:proto-google-cloud-firestore-v1beta1:jar:0.88.0 already exists in destination. io.opencensus:opencensus-contrib-grpc-util:jar:0.24.0 already exists in destination. io.grpc:grpc-protobuf:jar:1.30.0 already exists in destination. io.grpc:grpc-protobuf-lite:jar:1.30.0 already exists in destination. org.codehaus.mojo:animal-sniffer-annotations:jar:1.18 already exists in destination. io.grpc:grpc-api:jar:1.30.0 already exists in destination. com.google.api:gax-grpc:jar:1.57.0 already exists in destination. io.grpc:grpc-auth:jar:1.30.0 already exists in destination. io.grpc:grpc-netty-shaded:jar:1.30.0 already exists in destination. io.grpc:grpc-alts:jar:1.30.0 already exists in destination. io.grpc:grpc-grpclb:jar:1.30.0 already exists in destination. org.apache.commons:commons-lang3:jar:3.5 already exists in destination. org.conscrypt:conscrypt-openjdk-uber:jar:2.2.1 already exists in destination. io.grpc:grpc-stub:jar:1.30.0 already exists in destination. com.google.guava:guava:jar:29.0-android already exists in destination. org.slf4j:slf4j-api:jar:1.7.25 already exists in destination. io.netty:netty-codec-http:jar:4.1.50.Final already exists in destination. io.netty:netty-common:jar:4.1.50.Final already exists in destination. io.netty:netty-buffer:jar:4.1.50.Final already exists in destination. io.netty:netty-codec:jar:4.1.50.Final already exists in destination. io.netty:netty-handler:jar:4.1.50.Final already exists in destination. io.netty:netty-resolver:jar:4.1.50.Final already exists in destination. io.netty:netty-transport:jar:4.1.50.Final already exists in destination.

google-oss-bot commented 3 years ago

I found a few problems with this issue:

dconeybe commented 3 years ago

Note that this ticket's creation arose from the following discussion: https://groups.google.com/g/google-cloud-firestore-discuss/c/u2XYqr6U1H0/m/AQlzI65aAwAJ

hiranya911 commented 3 years ago

Should probably be reported directly at https://github.com/googleapis/java-firestore

dconeybe commented 3 years ago

Update: I was able to reproduce the timeout. Thanks for the excellent reproduction app! I have no idea yet what the root cause is but I will investigate and reply back here when I have something to report.

dconeybe commented 3 years ago

Update: I've opened a ticket with another GitHub repository: https://github.com/googleapis/gax-java/issues/1259. Let's see what happens with the discussion there.

thboulay commented 3 years ago

Do you have any news on this subject? A workaround?

dconeybe commented 3 years ago

Unfortunately, there is no update yet to give. I'm still waiting for a response on the issue opened in the gax-java repository and I wouldn't expect a response until mid-January due to the holidays. I should warn you, though, that although your use case is valid, the reality is that it's a corner case that could be challenging to find a timely resolution to. Since all of the code involved is open source, if you have a chance to dig down into it that would be incredibly helpful in speeding up the official resolution. Sorry I don't have better news.