Skip to content

DB close race: goroutines still running cause sql: database is closed errors #154

@sekulicd

Description

@sekulicd

Description
During shutdown, the database connection is closed before all background goroutines have finished their work. As a result, in-flight operations continue to use the DB and fail with errors like:
time="2026-04-23T11:57:47+02:00" level=error msg="failed to process commitment tx" error="sql: database is closed"
This indicates a race condition between DB shutdown and ongoing async processing (e.g. commitment tx handling).
Expected behavior
All goroutines that depend on the DB should gracefully finish (or be canceled) before the database is closed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions