Skip to content

mcs: fix panic of store not found#9781

Merged
ti-chi-bot[bot] merged 3 commits intotikv:masterfrom
rleungx:fix-nil-pointer
Sep 26, 2025
Merged

mcs: fix panic of store not found#9781
ti-chi-bot[bot] merged 3 commits intotikv:masterfrom
rleungx:fix-nil-pointer

Conversation

@rleungx
Copy link
Copy Markdown
Member

@rleungx rleungx commented Sep 26, 2025

What problem does this PR solve?

Issue Number: ref #5839.

What is changed and how does it work?

Fix the following issue:

[2025/09/26 01:52:51.583 +00:00] [WARN] [grpc_service.go:209] ["the store of the bucket in region is not found "] [region-id=46]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x29d5e4c]

goroutine 454 [running]:
[github.com/tikv/pd/pkg/core.(*StoreInfo).GetAddress(...)](http://github.com/tikv/pd/pkg/core.(*StoreInfo).GetAddress(...))
	/workspace/source/pd/pkg/core/store.go:337
[github.com/tikv/pd/pkg/mcs/scheduling/server.(*Service).RegionBuckets](http://github.com/tikv/pd/pkg/mcs/scheduling/server.(*Service).RegionBuckets)(0x400098a0a8, {0x34591d0, 0x40007612b0})
	/workspace/source/pd/pkg/mcs/scheduling/server/grpc_service.go:212 +0x1ac
[github.com/pingcap/kvproto/pkg/schedulingpb._Scheduling_RegionBuckets_Handler](http://github.com/pingcap/kvproto/pkg/schedulingpb._Scheduling_RegionBuckets_Handler)({0x3010060?, 0x400098a0a8}, {0x3452c98, 0x4000f881e0})
	/root/go/pkg/mod/[github.com/pingcap/kvproto@v0.0.0-20250923064352-8eeada0a8a03/pkg/schedulingpb/schedulingpb.pb.go:1713](http://github.com/pingcap/kvproto@v0.0.0-20250923064352-8eeada0a8a03/pkg/schedulingpb/schedulingpb.pb.go:1713) +0xdc
[google.golang.org/grpc.(*Server).processStreamingRPC](http://google.golang.org/grpc.(*Server).processStreamingRPC)(0x40009d4a00, {0x344d668, 0x400097dce0}, {0x345ab20, 0x4000488b60}, 0x4000856a20, 0x40008ffa70, 0x477b120, 0x0)
	/root/go/pkg/mod/[google.golang.org/grpc@v1.62.1/server.go:1680](http://google.golang.org/grpc@v1.62.1/server.go:1680) +0xe60
[google.golang.org/grpc.(*Server).handleStream](http://google.golang.org/grpc.(*Server).handleStream)(0x40009d4a00, {0x345ab20, 0x4000488b60}, 0x4000856a20)
	/root/go/pkg/mod/[google.golang.org/grpc@v1.62.1/server.go:1801](http://google.golang.org/grpc@v1.62.1/server.go:1801) +0xadc
[google.golang.org/grpc.(*Server).serveStreams.func2.1()](http://google.golang.org/grpc.(*Server).serveStreams.func2.1())
	/root/go/pkg/mod/[google.golang.org/grpc@v1.62.1/server.go:1027](http://google.golang.org/grpc@v1.62.1/server.go:1027) +0x84
created by [google.golang.org/grpc.(*Server).serveStreams.func2](http://google.golang.org/grpc.(*Server).serveStreams.func2) in goroutine 444
	/root/go/pkg/mod/[google.golang.org/grpc@v1.62.1/server.go:1038](http://google.golang.org/grpc@v1.62.1/server.go:1038) +0x13c

Check List

Tests

  • Unit test

Release note

None.

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. labels Sep 26, 2025
@ti-chi-bot ti-chi-bot bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 26, 2025
// As TiKV report buckets just after the region heartbeat, for new created region, PD may receive buckets report before the first region heartbeat is handled.
// So we should not return error here.
log.Warn("the store of the bucket in region is not found ", zap.Uint64("region-id", buckets.GetRegionId()))
continue
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The address can be nil if the store is nil

Copy link
Copy Markdown
Member Author

@rleungx rleungx Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it won't get the address if it is nil.

@rleungx rleungx requested a review from bufferflies September 26, 2025 02:41
@codecov
Copy link
Copy Markdown

codecov bot commented Sep 26, 2025

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 76.77%. Comparing base (0b32e6e) to head (35f58f3).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9781      +/-   ##
==========================================
- Coverage   76.87%   76.77%   -0.10%     
==========================================
  Files         488      488              
  Lines       77722    77727       +5     
==========================================
- Hits        59751    59678      -73     
- Misses      14337    14400      +63     
- Partials     3634     3649      +15     
Flag Coverage Δ
unittests 76.77% <85.71%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Sep 26, 2025
@rleungx
Copy link
Copy Markdown
Member Author

rleungx commented Sep 26, 2025

/retest

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Sep 26, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bufferflies, lhy1024

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [bufferflies,lhy1024]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 26, 2025
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Sep 26, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-09-26 02:59:42.525183163 +0000 UTC m=+584792.595676838: ☑️ agreed by lhy1024.
  • 2025-09-26 03:10:16.322291444 +0000 UTC m=+585426.392785125: ☑️ agreed by bufferflies.

@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Sep 26, 2025

@rleungx: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
non-block/pull-unit-test-next-gen 35f58f3 link false /test pull-unit-test-next-gen

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@rleungx
Copy link
Copy Markdown
Member Author

rleungx commented Sep 26, 2025

/retest

@ti-chi-bot ti-chi-bot bot merged commit ec8e27c into tikv:master Sep 26, 2025
28 of 29 checks passed
@rleungx rleungx deleted the fix-nil-pointer branch September 26, 2025 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants