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 transaction hangs for > 1 minute without logs #851

Closed
sjudd opened this issue Feb 21, 2024 · 2 comments
Closed

Firestore transaction hangs for > 1 minute without logs #851

sjudd opened this issue Feb 21, 2024 · 2 comments
Assignees
Labels
api: firestore Issues related to the googleapis/python-firestore API.

Comments

@sjudd
Copy link

sjudd commented Feb 21, 2024

Environment details

  • OS type and version: Google Cloud Run
  • Python version: 3.11.7
  • pip version: 23.3.1
  • google-cloud-firestore version: 2.14.0

Steps to reproduce

I'm a little unclear. The issue seems flaky. It seems related to having a lot of concurrent requests, but the requests are for different documents (albiet in the same table).

The table in question is a listing of individual files. I'm using a on_object_finalized firestore to function to look for an existing object in the table using something like:

        query_ref = files_ref.where(filter=FieldFilter("bucket", "==", bucket)).where(
            filter=FieldFilter("path", "==", path)
        )
        docs = transaction.get(query_ref)

Then if one isn't found, I create a new entry:

   new_doc_ref = files_ref.document()
    data = {
        "path": path,
        "bucket": bucket,
   }
   transaction.create(new_doc_ref, data)

Overall concurrency is quite low, something like 7-9 requests in a second. I've seen it happen with less.

Code example

See above

Stack traces

Sadly no logs appear. The function runs until it hits a 60s timeout (it usually finishes in 300-500ms when warm, up to 1.5 seconds when cold). Then the function exists. A log line is printed immediately before the transaction starts. But a log line immediately after the transaction is not printed.

Maybe this is related to #850 and/or #358?

@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/python-firestore API. label Feb 21, 2024
@daniel-sanche daniel-sanche self-assigned this Mar 19, 2024
@garysmall
Copy link

Seeing the same issue with cloud run and concurrent requests. Causes the whole instance to be unusable until it is spun down. Each following requests also returns a 504.

@sjudd
Copy link
Author

sjudd commented May 27, 2024

firebase/firebase-functions-python#181 has more details, a repro and a workaround from someone else.

@sjudd sjudd closed this as completed May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/python-firestore API.
Projects
None yet
Development

No branches or pull requests

3 participants