gastownhall/beads · warning
%s close timed out after %v
Error message
%s close timed out after %v
What it means
closeWithDeadline guards database Close calls that can hang. If the close does not finish within CloseTimeout, the library gives up waiting and returns '%s close timed out after %v' so callers are not blocked forever. The close may still complete later in the background.
Source
Thrown at internal/storage/doltutil/close.go:34
func CloseWithTimeout(name string, closeFn func() error) error {
timer := time.NewTimer(CloseTimeout)
defer timer.Stop()
return closeWithDeadline(name, closeFn, timer.C)
}
func closeWithDeadline(name string, closeFn func() error, deadline <-chan time.Time) error {
done := make(chan error, 1)
go func() {
done <- closeFn()
}()
select {
case err := <-done:
return err
case <-deadline:
// Close is hanging - log and continue rather than blocking forever
return fmt.Errorf("%s close timed out after %v", name, CloseTimeout)
}
}
View on GitHub (pinned to 71377f2769)
Solutions
- Wait past CloseTimeout and verify the process/database eventually released resources.
- Find and cancel in-flight queries/transactions before closing.
- Kill a hung embedded Dolt process if it never finishes closing.
- Increase CloseTimeout if legitimate large closes need more time.
Example fix
// before
defer store.Close() // may hang
// after
if err := doltutil.CloseWithTimeout(store, 5*time.Second); err != nil {
log.Printf("close problem (continuing): %v", err)
} Defensive patterns
Strategy: fallback
Validate before calling
// ensure no in-flight work before closing: // wg.Wait() on outstanding queries/transactions
Try / catch
if err := doltutil.CloseWithTimeout(store, 5*time.Second); err != nil {
log.Printf("close timed out, continuing: %v", err) // non-fatal
} Prevention
- Cancel outstanding queries before Close
- Avoid holding transactions across long waits
- Treat close timeout as a warning, not a data-loss signal
- Use CloseWithTimeout on every shutdown path
When it happens
Trigger: Calling CloseWithTimeout (or Close paths using closeWithDeadline) on a Dolt store whose underlying close blocks — e.g. in-flight queries, hung Dolt engine process, or an open transaction blocking shutdown.
Common situations: Long-running query still executing at shutdown; Dolt subprocess wedged; many open connections draining slowly; disk I/O stall.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- procid: process %d still matches token after fatal signal an
- timeout (%s) waiting for spawn marker %s; wait for the in-pr
- confirm verified pid %d stopped: %w
- timeout (%s) acquiring %s after inspecting pid %d at %s; sto
- server: DoltServer.Stop: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/7fda9329d73b1520.
Report an issue: GitHub.