Skip to content

feat(pinner): close pinner before repo on shutdown#11296

Open
lidel wants to merge 1 commit intomasterfrom
feat/pinner-close
Open

feat(pinner): close pinner before repo on shutdown#11296
lidel wants to merge 1 commit intomasterfrom
feat/pinner-close

Conversation

@lidel
Copy link
Copy Markdown
Member

@lidel lidel commented Apr 24, 2026

Important

This PR demonstrates how

Problem

The pinner's streaming goroutines hold a reference to the backing datastore, and pebble panics on use after Close. Before this change the panic was recovered inside the pinner (see ipfs/boxo#1146) and the symptom was only a transient log trace on daemon exit, but the race remained.

Fix

This PR wires the proper cleanup

Register a new fx OnStop hook that calls pinner.Close before the repo (and therefore the datastore) closes. Close drains all in-flight stream goroutines, so the datastore is closed only after the pinner is fully quiesced.

Context

The pinner's streaming goroutines hold a reference to the backing
datastore, and pebble panics on use after Close. Before this change
the panic was recovered inside the pinner (see ipfs/boxo#1146) and the
symptom was only a transient log trace on daemon exit, but the race
remained.

Register a new fx OnStop hook that calls pinner.Close before the repo
(and therefore the datastore) closes. Close drains all in-flight
stream goroutines, so the datastore is closed only after the pinner
is fully quiesced.

Bumps boxo to pick up Pinner.Close from ipfs/boxo#1150.

Fixes #11292
@lidel lidel marked this pull request as ready for review April 24, 2026 19:19
@lidel lidel requested a review from a team as a code owner April 24, 2026 19:19
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.

pebble panic on shutdown

1 participant