Skip to content

fix(heal): do not panic when CheckParts returns no result - #360

Open
lroehrs wants to merge 1 commit into
pgsty:mainfrom
ScaleCommerce:fix/heal-checkparts-nil-response
Open

lroehrs wants to merge 1 commit into
pgsty:mainfrom
ScaleCommerce:fix/heal-checkparts-nil-response

Conversation

@lroehrs

@lroehrs lroehrs commented Nov 25, 2026

Copy link
Copy Markdown

Motivation

A production node (Silo RELEASE.2026-11-12T00-00-00Z, 10 nodes × 8 drives, EC:4) crashed during an automatic background heal:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x2dd16f6]

goroutine 9767729901 [running]:
github.com/minio/minio/cmd.checkObjectWithAllParts(...)
	github.com/minio/minio/cmd/erasure-healing-common.go:428 +0x10d6
github.com/minio/minio/cmd.(*erasureObjects).healObject(...)
	github.com/minio/minio/cmd/erasure-healing.go:392 +0x1ac8
github.com/minio/minio/cmd.erasureObjects.HealObject(...)
	github.com/minio/minio/cmd/erasure-healing.go:1117 +0x891
github.com/minio/minio/cmd.(*erasureServerPools).healObjectInPool(...)
	github.com/minio/minio/cmd/erasure-server-pool-consistency.go:390 +0x365
github.com/minio/minio/cmd.(*erasureServerPools).HealObject.func1(...)
	github.com/minio/minio/cmd/erasure-server-pool.go:3120 +0x239
created by github.com/minio/minio/cmd.(*erasureServerPools).HealObject in goroutine 1493
	github.com/minio/minio/cmd/erasure-server-pool.go:3118 +0x491

The unrecovered panic in the heal goroutine terminated the whole server process. At that time the cluster was under heavy listing load and logged grid i/o timeouts / reconnects between nodes.

Root cause

checkObjectWithAllParts assumes that CheckParts/VerifyFile always returns a response when the error is nil, and indexes verifyResp.Results[p] (addr=0x8 = slice length of a nil *CheckPartsResp).

storageRESTClient.CheckParts can violate this:

  • muxClient.closeLocked() closes the response channel without sending an error (e.g. on close() during a disconnect, or after INTERNAL ERROR: Response was blocked).
  • handleOneWayStream then returns silently on the closed channel.
  • Stream.Results treats the closed channel as a normal end and returns nil.
  • CheckParts returns (nil, nil).

The local xlStorage implementations and the REST-based VerifyFile always return a result or an error.

Changes

  • storageRESTClient.CheckParts: if the stream ends without a response and without an error, return grid.ErrDisconnected (mapped to errDiskNotFound by toStorageErr).
  • checkObjectWithAllParts: defensively treat a nil or short CheckPartsResp as an unreachable drive (errDiskNotFound) instead of dereferencing it. This also prevents an index-out-of-range panic if a drive reports fewer part results than latestMeta.Parts.

I did not change the grid stream semantics (closed channel = success), because that affects all streaming RPCs. It may be worth a separate discussion.

Test evidence

  • New TestCheckObjectWithAllPartsMissingResult (normal and deep scan): one drive returns (nil, nil), one returns a short result.
    • Without the fix, it reproduces the production panic at erasure-healing-common.go:428.
    • With the fix, both drives are reported as checkPartDiskNotFound and the others as checkPartSuccess.
  • go test -tags kqueue,dev ./cmd -run 'CheckObjectWithAllParts|Heal|NativeAudit|StorageREST|CommonParities' passes.
  • make verifiers passes (rebrand compatibility baseline unchanged).
  • make build produces silo.
  • The client-side change has no dedicated test, as it would require a grid stream that closes mid-call. The panic itself is covered by the defensive check and its test.
  • The full make test suite was not run.

Compatibility notes

No change to storage format, wire protocol, RPC handlers, or any MINIO_* / x-minio-* / .minio.sys identifiers. The only behavioral change: a drive that previously produced (nil, nil) (and crashed the process) is now treated as offline for this heal check.

Documentation impact

None.

Related

A separate issue about objects written by older MinIO releases failing read/list with InsufficientReadQuorum (while mc admin heal repairs them) will be filed separately. That issue triggered the heal that hit this panic.


This fix was investigated and written with the assistance of AI (Claude by Anthropic). The analysis, the code, and the test results were reviewed by me before submission.

🤖 Generated with Claude Code

A remote CheckParts stream that ends without a response and without an
error (e.g. the grid mux is closed during a disconnect) made
storageRESTClient.CheckParts return (nil, nil). checkObjectWithAllParts
then dereferenced the nil response and crashed the whole server process.

Return grid.ErrDisconnected from the client in that case, and treat a
nil or short per-part result as an unreachable drive in
checkObjectWithAllParts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lucas Röhrs <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant