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 times out when using default DNS resolver #783

Open
sergiocampama opened this issue Apr 8, 2024 · 1 comment
Open

firestore times out when using default DNS resolver #783

sergiocampama opened this issue Apr 8, 2024 · 1 comment

Comments

@sergiocampama
Copy link

import asyncio
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore_async
import sys

async def main():
  user_id = sys.argv[1]

  cred = credentials.Certificate("credentials.json")
  firebase_admin.initialize_app(cred)

  db = firestore_async.client()

  user_ref = db.collection("users").document(user_id)
  user = await user_ref.get()
  print(user)

if __name__ == "__main__":
  asyncio.run(main())

This code, using a firebase service account credential, and a database with a users table, will hang for 60 seconds and will fail with a DNS error, this one:

D0408 14:38:20.114377000 7971737600 grpc_ares_wrapper.cc:723]          (c-ares resolver) request:0x60000318e4e0 on_hostbyname_done_locked: C-ares status is not ARES_SUCCESS qtype=AAAA name=firestore.googleapis.com is_balancer=0: DNS query cancelled
D0408 14:38:20.114381000 7971737600 grpc_ares_wrapper.cc:723]          (c-ares resolver) request:0x60000318e4e0 on_hostbyname_done_locked: C-ares status is not ARES_SUCCESS qtype=A name=firestore.googleapis.com is_balancer=0: DNS query cancelled
...
D0408 14:38:20.114467000 7971737600 dns_resolver_ares.cc:328]          (c-ares resolver) resolver:0x600003f8d4a0 dns resolution failed: UNKNOWN:C-ares status is not ARES_SUCCESS qtype=A name=firestore.googleapis.com is_balancer=0: DNS query cancelled {created_time:"2024-04-08T14:38:20.114389-04:00", children:[UNKNOWN:C-ares status is not ARES_SUCCESS qtype=AAAA name=firestore.googleapis.com is_balancer=0: DNS query cancelled {created_time:"2024-04-08T14:38:20.114379-04:00"}]}

This is with firebase-admin 6.5.0 and python 3.12.2

Workaround

Call the python script with this environment variable:

GRPC_DNS_RESOLVER=native

works around the issue.

@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

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