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 Emulator: running two transactions on the same document in parallel causes timeout in the database #3969

Closed
dex3r opened this issue Dec 23, 2021 · 3 comments

Comments

@dex3r
Copy link

dex3r commented Dec 23, 2021

[REQUIRED] Environment info

firebase-tools: 9.23.0

Platform: Windows

[REQUIRED] Test case

C# code, using .NET core 3.1 and official google-cloud-dotnet Admin SDK.

https://gist.github.com/dex3r/9b380eaad1a036f3dc5eb7247c2d9333

This code contains a Transaction that is started twice (for the same document) and then both of them are awaited.
To fail, the transaction has to contain a read a set. Two transactions has to alter the same document.

[REQUIRED] Steps to reproduce

Run DoubleTransactionParallel method.

[REQUIRED] Expected behavior

Both transactions should execute, altering/creating a new document with given payload.
This is observed when running this code on GCP.

[REQUIRED] Actual behavior

Exception is thrown:

Grpc.Core.RpcException : Status(StatusCode="Unknown", Detail="", DebugException="Grpc.Core.Internal.CoreErrorDetailException: {"created":"@1640285087.996000000","description":"Error received from peer ipv4:127.0.0.1:8080","file":"..\..\..\src\core\lib\surface\call.cc","file_line":1068,"grpc_message":"","grpc_status":2}")
   at Google.Api.Gax.Grpc.ApiCallRetryExtensions.<>c__DisplayClass0_0`2.<<WithRetry>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Google.Cloud.Firestore.WriteBatch.CommitAsync(ByteString transactionId, CancellationToken cancellationToken)
   at Google.Cloud.Firestore.FirestoreDb.RunTransactionAsync[T](Func`2 callback, TransactionOptions options, CancellationToken cancellationToken)
   at Google.Cloud.Firestore.FirestoreDb.RunTransactionAsync[T](Func`2 callback, TransactionOptions options, CancellationToken cancellationToken)

Additionally, no data is actually stored in the database (no data is present in the emulator UI)

firestore-debug.log file content: https://gist.github.com/dex3r/7666d3c46b3a60cbce90ddbd5fd580c6

firebase emulators:start --debug output:
https://gist.github.com/dex3r/7293a0bcccec7cb5cc9a71b0f79b8fb0


Unfortunately bulk of our code depends on running transactions. This bug makes our code untestable. The code can only be tested once deployed to GCF, making development almost impossible. We have to wait for a fix, so any ETA would be appreciated. As for now, is it possible to run production version Firestore in Docker? Is Firestore source/server binary even available?

@dex3r
Copy link
Author

dex3r commented Jan 18, 2022

Hi again, will this issue be worked on? I don't see "needs attention" label nor any replies for almost a month. Should I assume this will never be solved?

@dex3r
Copy link
Author

dex3r commented Jan 18, 2022

@bkendall

@yuchenshi
Copy link
Member

Duplicate of #2452

@yuchenshi yuchenshi marked this as a duplicate of #2452 Jan 19, 2022
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

3 participants