Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

firestore times out when using default DNS resolver

未关闭
#783 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
28/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python

调研方向

首先使用 firebase-admin 6.5.0 和 Python 3.12.2 运行 issue 中的 asyncio Firestore 示例,然后使用 GRPC_DNS_RESOLVER=native 重复运行。调查 c-ares 日志所涉及的默认解析器路径;完成的标准是:无需 workaround,示例不再等待 60 秒或因 DNS 失败。

由索引模型根据 Issue 内容生成。

描述

api: firestore
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.

主要语言
Python
星标
1.2k
派生
359
平均合并
3 天 9 小时
30 天内合并 PR
3

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

firebase/firebase-admin-python 的其他 Issue

查看 firebase/firebase-admin-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。