Skip to content

Three-step postgres exit may not complete #4820

@e-gineer

Description

@e-gineer

Description

The doThreeStepPostgresExit() function attempts graceful shutdown with SIGTERM, then SIGINT, then SIGQUIT, with timeouts at each step. However, if all three signals fail (process is hung or unresponsive), the function returns an error but the process may still be running. The function correctly avoids SIGKILL per Postgres documentation, but this means truly stuck processes may not be cleaned up.

Severity

MEDIUM - Resource leak (stuck process)

Test Reference

Test: TestDoThreeStepPostgresExit_Timeout in pkg/db/db_local/stop_services_test.go:117 (skipped)

Suggested Fix

Document this behavior clearly and potentially add monitoring/alerting for cases where postgres doesn't stop.

Related Code

  • pkg/db/db_local/stop_services.go:252-295

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions