[BanyanDB] Data race and nil-pointer panic: measure write during standalone shutdown after segment close
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Search before asking
- I had searched in the issues and found no similar issues.
Apache SkyWalking Component
BanyanDB (apache/skywalking-banyandb)
What happened
During shutdown of a standalone node, a measure write that is still in flight hits a segment whose series index was already closed. The race detector reports a data race, and the write batch panics with a nil pointer dereference:
- Write side:
measureService.Write→writeSession.Finish→sealLockedstarts awrite-batchgoroutine →publishOnce→localBatchPublisher.Close→bus.Publish→measure.(*writeCallback).Rev→dps.segment.IndexDB().Insert(...)(banyand/measure/write_standalone.go:566). - Close side:
schemaRepo.Close→group.close→database.Close→segmentController.close→segment.closeResourcesLocked, which setss.index = nil(banyand/internal/storage/segment.go:357).
Root cause: oklog/run interrupts units one at a time in registration order ([email protected]/group.go:47). In pkg/cmdsetup/standalone.go, measureSvc (and the other storage services) are registered before grpcServer, so the storage is closed while the liaison gRPC server can still accept writes and run write batches. The write holds a segment reference, but database.Close closes the segment regardless.
Observed in CI as TestStandaloneActiveSeries (test/integration/standalone/active_series) failing with race detected during execution of test, even though all specs passed. It fired at teardown. It hit apache/skywalking-banyandb#1508 twice in a row (Integration Standalone – Remainder, America/Los_Angeles), although that PR touches only trace/sidx code. It did not reproduce in 3 local runs on main or on the PR branch, so it depends on timing.
What you expected to happen
Shutdown should stop accepting writes before closing storage, and in-flight writes should either complete or fail with an error. No data race and no panic.
How to reproduce
Timing-dependent. Run TZ=America/Los_Angeles go test -race ./test/integration/standalone/active_series/ repeatedly on CI runners. The race fires when a measure write batch is in flight while the node shuts down.
Anything else
Possible fixes, which can be combined:
- Stop the gRPC and HTTP servers before the storage services on shutdown, e.g. register them earlier or add an explicit shutdown phase, so in-flight write streams drain before
schemaRepo.Close. Check the data node and liaison command setups for the same ordering. - Make
segment.IndexDB()/ segment close respect outstanding references, or make the write path return an error on a closed segment instead of panicking.
Are you willing to submit a pull request to fix on your own?
- Yes I am willing to submit a pull request!
Code of Conduct
- I agree to follow this project's Code of Conduct
- Ngôn ngữ chính
- Java
- Star
- 25k
- Fork
- 6.6k
- Merge trung bình
- 10 giờ 45 phút
- Pull request đã merge (30 ngày)
- 49
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc 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 apache/skywalking
-
[Bug] [BanyanDB] timestamp.ParseDuration silently drops everything after "d"Có thể đã có người làm @soujasK đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
apache/skywalking#14287 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BanyanDB] Let trace queries exclude the raw span from resultsCó thể đã có người làm @hanahmily đã nhận hôm nay. Đang mởenhancement
apache/skywalking#14288 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
apache/skywalking#14283 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BanyanDB] Store trace binary tags only in core storage, not in secondary index (sidx)Có thể đã có người làm @hanahmily đã nhận hôm nay. Đang mởenhancement
apache/skywalking#14282 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] BanyanDB stream query on a hot entity scans all its rows despite a small limitCó thể đã có người làm @hanahmily đã nhận 8 ngày trước. Đang mởbug
apache/skywalking#14261 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/skywalking
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
testng-team/testng#3672 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
eclipse-edc/IdentityHub#1296 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
cloudfoundry/uaa#4194 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ui: 進捗状況線ダイアログが日本語表示で英語のままĐang mởarea: ui priority: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
tetsuji16/microProject#1721 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày