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

Firestore Promises never complete when running app for testing with detox on Android #3981

Closed
2 tasks done
robotlovesyou opened this issue Mar 15, 2023 · 3 comments
Closed
2 tasks done

Comments

@robotlovesyou
Copy link

What happened?

I have encountered an issue where, when the app is run for detox tests, firestore promises never complete, successfully or otherwise. This effectively causes the app to become idle.

This appears to be caused by a conflict between versions of protobuf-lite when running the instrumented version of the app required by detox. I found a workaround in issue #3957 in this comment

I'm creating this as a separate issue because the behavior described there is completely different to the behavior I experienced, and since the required device logs are not surfaced by the react-native CLI it took me a long time to discover the route cause. In fact I only discovered it when following the instructions to create the original version of this issue, which did not include a root cause or a workaround

I'm pretty new to react native, which may have been the cause of it taking me so long to discover the detailed device logs but it may be worthwhile including the --record-logs all step in your troubleshooting guide. I'm happy to submit a PR for that if it is felt appropriate.

What was the expected behaviour?

Firestore promises complete.

Was it tested on latest Detox?

  • I have tested this issue on the latest Detox release and it still reproduces.

Did your test throw out a timeout?

Help us reproduce this issue!

I created a simple test project to reproduce this behavior but I am not sure how to sanitise it for public release since it includes firebase client config. I'm happy to give access to people from this project who require it though

In what environment did this happen?

Detox version: 20.5.0
React Native version: 10.2.0
Has Fabric (React Native's new rendering system) enabled: I don't know. If this is enabled by default on new react native apps then yes, otherwise no.
Node version: v16.19.1
Device model: Android Emulator (Pixel 5)
Android version: 12
Test-runner (select one): jest

Detox logs

Detox logs

Github is complaining that the body is too long when I include this so I have placed it in this gist

Device logs

Device logs I'm only including what appears to be the appropriate block here, since the full logs are huge. I can provide full logs on request ``` 03-15 11:02:07.327 19922 19922 E detox : at java.lang.reflect.Method.invoke(Native Method) 03-15 11:02:07.327 19922 19922 E detox : at org.joor.Reflect.on(Reflect.java:723) 03-15 11:02:07.327 19922 19922 E detox : at org.joor.Reflect.call(Reflect.java:427) 03-15 11:02:07.327 19922 19922 E detox : at com.wix.detox.espresso.UiAutomatorHelper$2.run(UiAutomatorHelper.java:60) 03-15 11:02:07.327 19922 19922 E detox : at com.wix.detox.common.UIThread.postSync$lambda-0(UIThread.kt:19) 03-15 11:02:07.327 19922 19922 E detox : at com.wix.detox.common.UIThread.$r8$lambda$_Z79tZbTHJk11n0eI4HC0LzUHu0(Unknown Source:0) 03-15 11:02:07.327 19922 19922 E detox : at com.wix.detox.common.UIThread$$ExternalSyntheticLambda1.call(Unknown Source:2) 03-15 11:02:07.327 19922 19922 E detox : at java.util.concurrent.FutureTask.run(FutureTask.java:266) 03-15 11:02:07.327 19922 19922 E detox : at android.os.Handler.handleCallback(Handler.java:938) 03-15 11:02:07.327 19922 19922 E detox : at android.os.Handler.dispatchMessage(Handler.java:99) 03-15 11:02:07.327 19922 19922 E detox : at android.os.Looper.loopOnce(Looper.java:201) 03-15 11:02:07.327 19922 19922 E detox : at android.os.Looper.loop(Looper.java:288) 03-15 11:02:07.327 19922 19922 E detox : at android.app.ActivityThread.main(ActivityThread.java:7839) 03-15 11:02:07.327 19922 19922 E detox : at java.lang.reflect.Method.invoke(Native Method) 03-15 11:02:07.327 19922 19922 E detox : at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 03-15 11:02:07.327 19922 19922 E detox : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 03-15 11:02:07.327 19922 19922 E detox : Caused by: java.lang.RuntimeException: Internal error in Cloud Firestore (24.4.4). 03-15 11:02:07.327 19922 19922 E detox : at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$3(AsyncQueue.java:545) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firebase.firestore.util.AsyncQueue$$ExternalSyntheticLambda6.run(Unknown Source:2) 03-15 11:02:07.327 19922 19922 E detox : at android.os.Handler.handleCallback(Handler.java:938) 03-15 11:02:07.327 19922 19922 E detox : at android.os.Handler.dispatchMessage(Handler.java:99) 03-15 11:02:07.327 19922 19922 E detox : at androidx.test.espresso.base.Interrogator.loopAndInterrogate(Interrogator.java:14) 03-15 11:02:07.327 19922 19922 E detox : at androidx.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:8) 03-15 11:02:07.327 19922 19922 E detox : at androidx.test.espresso.base.UiControllerImpl.loopMainThreadUntilIdle(UiControllerImpl.java:17) 03-15 11:02:07.327 19922 19922 E detox : at androidx.test.espresso.base.UiControllerImpl.loopMainThreadForAtLeast(UiControllerImpl.java:9) 03-15 11:02:07.327 19922 19922 E detox : ... 16 more 03-15 11:02:07.327 19922 19922 E detox : Caused by: java.lang.NoSuchMethodError: No static method registerDefaultInstance(Ljava/lang/Class;Lcom/google/protobuf/GeneratedMessageLite;)V in class Lcom/google/protobuf/GeneratedMessageLite; or its super classes (declaration of 'com.google.protobuf.GeneratedMessageLite' appears in /data/app/~~o6Va_QOWxjJTA8dkrym2_Q==/com.targetproject.test-8xSu5j_gH9tvFACNz_CEiA==/base.apk) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firestore.v1.ListenRequest.(ListenRequest.java:873) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firestore.v1.ListenRequest.getDefaultInstance(ListenRequest.java:878) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firestore.v1.FirestoreGrpc.getListenMethod(FirestoreGrpc.java:414) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firebase.firestore.remote.WatchStream.(WatchStream.java:61) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firebase.firestore.remote.Datastore.createWatchStream(Datastore.java:138) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firebase.firestore.remote.RemoteStore.(RemoteStore.java:171) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firebase.firestore.core.MemoryComponentProvider.createRemoteStore(MemoryComponentProvider.java:77) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firebase.firestore.core.ComponentProvider.initialize(ComponentProvider.java:153) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firebase.firestore.core.FirestoreClient.initialize(FirestoreClient.java:292) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firebase.firestore.core.FirestoreClient.lambda$new$0$com-google-firebase-firestore-core-FirestoreClient(FirestoreClient.java:111) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firebase.firestore.core.FirestoreClient$$ExternalSyntheticLambda12.run(Unknown Source:8) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$2(AsyncQueue.java:444) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firebase.firestore.util.AsyncQueue$$ExternalSyntheticLambda0.call(Unknown Source:2) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(AsyncQueue.java:330) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$$ExternalSyntheticLambda2.run(Unknown Source:4) 03-15 11:02:07.327 19922 19922 E detox : at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462) 03-15 11:02:07.327 19922 19922 E detox : at java.util.concurrent.FutureTask.run(FutureTask.java:266) 03-15 11:02:07.327 19922 19922 E detox : at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301) 03-15 11:02:07.327 19922 19922 E detox : at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 03-15 11:02:07.327 19922 19922 E detox : at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 03-15 11:02:07.327 19922 19922 E detox : at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(AsyncQueue.java:235) 03-15 11:02:07.327 19922 19922 E detox : at java.lang.Thread.run(Thread.java:920) 03-15 11:02:07.433 19922 20045 D nativeloader: classloader namespace configured for unbundled product apk. library_path=/product/priv-app/PrebuiltGmsCore/lib/x86_64:/product/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk!/lib/x86_64:/product/lib64:/system/product/lib64 03-15 11:02:07.457 19922 20045 I m.targetprojec: Waiting for a blocking GC ClassLinker 03-15 11:02:07.499 19922 20045 I m.targetprojec: WaitForGcToComplete blocked ClassLinker on Background for 41.355ms 03-15 11:02:07.501 19922 19933 W System : A resource failed to call close. 03-15 11:02:07.547 19922 20045 V NativeCrypto: Registering com/google/android/gms/org/conscrypt/NativeCrypto's 295 native methods... 03-15 11:02:07.573 19922 20045 W m.targetprojec: Accessing hidden method Ljava/security/spec/ECParameterSpec;->getCurveName()Ljava/lang/String; (unsupported, reflection, allowed) 03-15 11:02:07.618 19922 20045 I ProviderInstaller: Installed default security provider GmsCore_OpenSSL 03-15 11:02:07.648 19922 20045 W Firestore: (24.4.4) [AsyncQueue]: Refused to enqueue task after panic

</details>

### More data, please!

_No response_
@stale
Copy link

stale bot commented Apr 25, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this repository, read this discussion.

@stale stale bot added the 🏚 stale label Apr 25, 2023
@stale
Copy link

stale bot commented May 3, 2023

The issue has been closed for inactivity.

@stale stale bot closed this as completed May 3, 2023
@blumendorf
Copy link

blumendorf commented Sep 29, 2023

I ran into this issue too today on detox v20.12.1 ...

I found this issue:
#3957

I am working on an unejected expo project (expo + detox + firebase), so things are a bit extra tricky sometimes.
So, while the proposed solution seems to fix the problem, it would need to be included into expos @config-plugins/detox, I think.

Below is the error message that I see in adb logcat.

As far as I understand, the error below suggests that Protocol Buffers is not available as required by Cloud Firestore.
java.lang.NoSuchMethodError: No static method registerDefaultInstance(Ljava/lang/Class;Lcom/google/protobuf/GeneratedMessageLite;)V in class Lcom/google/protobuf/GeneratedMessageLite;

This seems to be related to the an update in Espresso 3.4.0 as suggested here:
https://stackoverflow.com/questions/74449061/espresso-contrib-3-3-0-works-fine-but-any-newer-version-results-in-build-failure/75249520#75249520

Rolling back to detox 20.0.3 solves the issue (but raises other problems in our setup).

I would like to propose to reopen this issue.

10041 10106 W DynamiteModule: Local module descriptor class for com.google.android.gms.providerinstaller.dynamite not found.
 7200  7216 W ProviderHelper: Unknown dynamite feature providerinstaller.dynamite
10041 10106 I DynamiteModule: Considering local module com.google.android.gms.providerinstaller.dynamite:0 and remote module com.google.android.gms.providerinstaller.dynamite:0
10041 10106 W ProviderInstaller: Failed to load providerinstaller module: No acceptable module com.google.android.gms.providerinstaller.dynamite found. Local version is 0 and remote version is 0.
10041 10106 D nativeloader: Configuring clns-11 for other apk /system/framework/org.apache.http.legacy.jar. target_sdk_version=34, uses_libraries=ALL, library_path=/data/app/~~noV_sOELXFVgm4RdNukXeg==/com.google.android.gms-ZzaH1hkkbBfz9IYbL69L0A==/lib/arm64:/data/app/~~noV_sOELXFVgm4RdNukXeg==/com.google.android.gms-ZzaH1hkkbBfz9IYbL69L0A==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.google.android.gms
10041 10106 D nativeloader: Configuring clns-12 for other apk /system/framework/com.android.media.remotedisplay.jar. target_sdk_version=34, uses_libraries=ALL, library_path=/data/app/~~noV_sOELXFVgm4RdNukXeg==/com.google.android.gms-ZzaH1hkkbBfz9IYbL69L0A==/lib/arm64:/data/app/~~noV_sOELXFVgm4RdNukXeg==/com.google.android.gms-ZzaH1hkkbBfz9IYbL69L0A==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.google.android.gms
10041 10106 D nativeloader: Configuring clns-13 for other apk /system/framework/com.android.location.provider.jar. target_sdk_version=34, uses_libraries=ALL, library_path=/data/app/~~noV_sOELXFVgm4RdNukXeg==/com.google.android.gms-ZzaH1hkkbBfz9IYbL69L0A==/lib/arm64:/data/app/~~noV_sOELXFVgm4RdNukXeg==/com.google.android.gms-ZzaH1hkkbBfz9IYbL69L0A==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.google.android.gms
10041 10106 D ApplicationLoaders: Returning zygote-cached class loader: /system_ext/framework/androidx.window.extensions.jar
10041 10106 D ApplicationLoaders: Returning zygote-cached class loader: /system_ext/framework/androidx.window.sidecar.jar
  519   955 D ConnectivityService: requestNetwork for uid/pid:10196/10041 activeRequest: null callbackRequest: 251 [NetworkRequest [ REQUEST id=252, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VCN_MANAGED Uid: 10196 RequestorUid: 10196 RequestorPkg: xxx.xxxx.xxx.com UnderlyingNetworks: Null] ]] callback flags: 0 order: 2147483647
  519   785 D WifiNetworkFactory: got request NetworkRequest [ REQUEST id=252, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VCN_MANAGED Uid: 10196 RequestorUid: 10196 RequestorPkg: xxx.xxxx.xxx.com UnderlyingNetworks: Null] ]
  519   785 D UntrustedWifiNetworkFactory: got request NetworkRequest [ REQUEST id=252, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VCN_MANAGED Uid: 10196 RequestorUid: 10196 RequestorPkg: xxx.xxxx.xxx.com UnderlyingNetworks: Null] ]
  519   785 D OemPaidWifiNetworkFactory: got request NetworkRequest [ REQUEST id=252, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VCN_MANAGED Uid: 10196 RequestorUid: 10196 RequestorPkg: xxx.xxxx.xxx.com UnderlyingNetworks: Null] ]
  519   785 D MultiInternetWifiNetworkFactory: got request NetworkRequest [ REQUEST id=252, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VCN_MANAGED Uid: 10196 RequestorUid: 10196 RequestorPkg: xxx.xxxx.xxx.com UnderlyingNetworks: Null] ]
  519   792 D ConnectivityService: NetReassign [252 : null → 100] [c 0] [a 1] [i 0]
10041 10041 E detox   : Failed to sync Espresso manually.
10041 10041 E detox   : java.lang.reflect.InvocationTargetException
10041 10041 E detox   :      at java.lang.reflect.Method.invoke(Native Method)
10041 10041 E detox   :      at org.joor.Reflect.on(Reflect.java:723)
10041 10041 E detox   :      at org.joor.Reflect.call(Reflect.java:427)
10041 10041 E detox   :      at com.wix.detox.espresso.UiAutomatorHelper$2.run(UiAutomatorHelper.java:60)
10041 10041 E detox   :      at com.wix.detox.common.UIThread.postSync$lambda-0(UIThread.kt:19)
10041 10041 E detox   :      at com.wix.detox.common.UIThread.$r8$lambda$_Z79tZbTHJk11n0eI4HC0LzUHu0(Unknown Source:0)
10041 10041 E detox   :      at com.wix.detox.common.UIThread$$ExternalSyntheticLambda1.call(Unknown Source:2)
10041 10041 E detox   :      at java.util.concurrent.FutureTask.run(FutureTask.java:264)
10041 10041 E detox   :      at android.os.Handler.handleCallback(Handler.java:958)
10041 10041 E detox   :      at android.os.Handler.dispatchMessage(Handler.java:99)
10041 10041 E detox   :      at android.os.Looper.loopOnce(Looper.java:205)
10041 10041 E detox   :      at android.os.Looper.loop(Looper.java:294)
10041 10041 E detox   :      at android.app.ActivityThread.main(ActivityThread.java:8177)
10041 10041 E detox   :      at java.lang.reflect.Method.invoke(Native Method)
10041 10041 E detox   :      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
10041 10041 E detox   :      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
10041 10041 E detox   : Caused by: java.lang.RuntimeException: Internal error in Cloud Firestore (24.8.1).
10041 10041 E detox   :      at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$3(AsyncQueue.java:545)
10041 10041 E detox   :      at com.google.firebase.firestore.util.AsyncQueue$$ExternalSyntheticLambda6.run(Unknown Source:2)
10041 10041 E detox   :      at android.os.Handler.handleCallback(Handler.java:958)
10041 10041 E detox   :      at android.os.Handler.dispatchMessage(Handler.java:99)
10041 10041 E detox   :      at androidx.test.espresso.base.Interrogator.loopAndInterrogate(Interrogator.java:14)
10041 10041 E detox   :      at androidx.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:8)
10041 10041 E detox   :      at androidx.test.espresso.base.UiControllerImpl.loopMainThreadUntilIdle(UiControllerImpl.java:17)
10041 10041 E detox   :      at androidx.test.espresso.base.UiControllerImpl.loopMainThreadForAtLeast(UiControllerImpl.java:9)
10041 10041 E detox   :      ... 16 more
10041 10041 E detox   : Caused by: java.lang.NoSuchMethodError: No static method registerDefaultInstance(Ljava/lang/Class;Lcom/google/protobuf/GeneratedMessageLite;)V in class Lcom/google/protobuf/GeneratedMessageLite; or its super classes (declaration of 'com.google.protobuf.GeneratedMessageLite' appears in /data/app/~~OANV8CO0nVBhQX8gR5wNgA==/xxx.xxxx.xxx.com.test-u_jyK0-SOpPnYTb9MmWoAw==/base.apk)
10041 10041 E detox   :      at com.google.firestore.v1.ListenRequest.<clinit>(ListenRequest.java:873)
10041 10041 E detox   :      at com.google.firestore.v1.FirestoreGrpc.getListenMethod(FirestoreGrpc.java:414)
10041 10041 E detox   :      at com.google.firebase.firestore.remote.WatchStream.<init>(WatchStream.java:61)
10041 10041 E detox   :      at com.google.firebase.firestore.remote.Datastore.createWatchStream(Datastore.java:138)
10041 10041 E detox   :      at com.google.firebase.firestore.remote.RemoteStore.<init>(RemoteStore.java:174)
10041 10041 E detox   :      at com.google.firebase.firestore.core.MemoryComponentProvider.createRemoteStore(MemoryComponentProvider.java:103)
10041 10041 E detox   :      at com.google.firebase.firestore.core.ComponentProvider.initialize(ComponentProvider.java:153)
10041 10041 E detox   :      at com.google.firebase.firestore.core.FirestoreClient.initialize(FirestoreClient.java:296)
10041 10041 E detox   :      at com.google.firebase.firestore.core.FirestoreClient.lambda$new$0$com-google-firebase-firestore-core-FirestoreClient(FirestoreClient.java:114)
10041 10041 E detox   :      at com.google.firebase.firestore.core.FirestoreClient$$ExternalSyntheticLambda14.run(Unknown Source:8)
10041 10041 E detox   :      at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$2(AsyncQueue.java:444)
10041 10041 E detox   :      at com.google.firebase.firestore.util.AsyncQueue$$ExternalSyntheticLambda0.call(Unknown Source:2)
10041 10041 E detox   :      at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(AsyncQueue.java:330)
10041 10041 E detox   :      at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$$ExternalSyntheticLambda2.run(Unknown Source:4)
10041 10041 E detox   :      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
10041 10041 E detox   :      at java.util.concurrent.FutureTask.run(FutureTask.java:264)
10041 10041 E detox   :      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
10041 10041 E detox   :      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
10041 10041 E detox   :      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
10041 10041 E detox   :      at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(AsyncQueue.java:235)
10041 10041 E detox   :      at java.lang.Thread.run(Thread.java:1012)

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

No branches or pull requests

2 participants