Skip to content

Too Many Clients Already / Connection Slot Exhaustion #262

@pyramation

Description

@pyramation

issue for pgsql-test

Summary

Postgres intermittently throws:

sorry, too many clients already

or

remaining connection slots are reserved for roles with the SUPERUSER attribute

indicating the test framework is exhausting available connections.

Cause

Unclosed or overlapping connections during parallel tests, or a low max_connections limit. It could be failing/breaking tests eat connections and we need to clean those up.

temporary fix / debug:

-- List all current connections
SELECT pid, usename, state, query
FROM pg_stat_activity;

-- Terminate all idle connections
SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE state = 'idle' AND pid <> pg_backend_pid();

-- (optional) terminate all except your current one
SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE pid <> pg_backend_pid();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions