[Firestore]
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- google-cloud, nodejs, typescript
Hướng nghiên cứu
Bắt đầu với điểm vào được nêu: admin.firestore().collection('users').doc(userId).get() trong trình xử lý onRequest của Gen 2, và so sánh phần đo thời gian của nó với các trường hợp nhanh và chậm được liệt kê. Kiểm tra các phiên bản dependency của Firestore và gRPC cùng với hành vi của Cloud Run instance được mô tả. Công việc được xem là hoàn tất khi xác định được nguyên nhân có thể tái hiện hoặc đường dẫn khôi phục hoặc thất bại đã được xác nhận đối với các lần đọc bị đình trệ, kèm bằng chứng rằng các lần đọc bình thường vẫn không bị ảnh hưởng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
[READ] Step 1: Are you in the right place?
I believe this belongs in nodejs-firestore because the issue is specifically with Firestore Admin SDK document reads,
and firebase-admin is using @google-cloud/firestore underneath.
[REQUIRED] Step 2: Describe your environment
* Operating System version: macOS 26.3.1
* Firebase SDK version: `firebase-admin@13.10.0`
* `@google-cloud/firestore@7.11.6`
* `@grpc/grpc-js@1.14.4`
* `firebase-functions@7.2.5`
* `firebase-tools@15.18.0`
* Firebase Product: Firestore
* Node.js version: v22.22.2
* NPM version: 10.9.7
Runtime environment: Firebase Cloud Functions Gen 2 / Cloud Run, Node.js 22.
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
I am seeing intermittent very slow Firestore Admin SDK reads from Firebase Gen 2 public onRequest functions.
The function handles high-volume redirect/callback traffic. Inside the handler, it performs a simple Firestore document
read:
await admin.firestore().collection('users').doc(userId).get()
Most reads are normal, usually tens of milliseconds. However, a small percentage intermittently take multiple seconds,
sometimes 10s+, and I recently observed one simple users/{userId}.get() taking ~23s.
The slow reads do not appear to be explained by application-level document contention or document size:
- The slow reads are not concentrated on a single userId.
- The slow user documents are normal-sized, roughly 4KB-14KB in the samples checked.
- A fast-user sample had similar or larger documents, including p95 around 20KB.
- Firestore audit logs did not show same-document writes during the slow read windows.
- CPU and memory on Cloud Run are not saturated.
- Cloud Run request concurrency is low.
- The same collection and similar reads from onCall functions appear to return normally.
- The issue seems concentrated in high-traffic public Gen 2 onRequest functions.
- Replacing/flushing the Cloud Run instances with a no-code gcloud run services update clears the issue temporarily.
This makes it look like some warm instances may get into a degraded Firestore client/channel state where individual
reads stall for seconds, but the Node process remains otherwise healthy.
Example timing from production instrumentation:
{
"operation": "users/{userId}.get()",
"userGetMs": 23220,
"documentSizeBytes": 10278,
"sameDocumentWritesDuringRead": 0
}
Other slow examples in the same window included userGetMs around 3s-6s, while p50/p95 stayed normal.
Expected behavior:
A simple doc().get() for a small Firestore document should not intermittently hang for 5s-20s+ on otherwise healthy warm
Cloud Run / Gen 2 function instances. If the Firestore client/channel becomes unhealthy, I would expect it to recover,
fail clearly, or expose an actionable error rather than continuing to serve rare but very slow reads until the instance
is replaced.
Actual behavior:
Most reads are fast, but a small long tail of reads stalls for seconds. Restarting/replacing Cloud Run instances
temporarily resolves it.
#### Relevant Code:
import * as admin from 'firebase-admin'
import { onRequest } from 'firebase-functions/v2/https'
import { performance } from 'perf_hooks'
admin.initializeApp()
export let routerRedirect = onRequest(async (req, res) => {
let userId: string = String(req.query.userId)
let userGetStartMs: number = performance.now()
let userDoc: admin.firestore.DocumentSnapshot = await admin
.firestore()
.collection('users')
.doc(userId)
.get()
let userGetMs: number = performance.now() - userGetStartMs
console.log({
message: 'firestoreUserGetTiming',
userId,
userGetMs,
exists: userDoc.exists
})
res.status(200).send('ok')
})
- Ngôn ngữ chính
- TypeScript
- Star
- 1.7k
- Fork
- 419
- Merge trung bình
- 4 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 16
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của firebase/firebase-admin-node
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
firebase/firebase-admin-node#3234 ·
-
firebase/firebase-admin-node#3221 · 3 bình luận · 1 người được giao ·
-
api: messaging
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
firebase/firebase-admin-node#3215 ·
-
api: messaging
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
firebase/firebase-admin-node#3214 ·
-
api: firestore type: feature request
firebase/firebase-admin-node#3183 · 1 bình luận · 1 người được giao ·
Tất cả issue của firebase/firebase-admin-node
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mksglu/context-mode#1200 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anthropics/claude-code#96687 ·
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
AOSSIE-Org/DebateAI#582 · 2 bình luận ·