Skip to content

ProxySQL fails to keep idle connection open for PostgreSQL databases #5972

Description

@PGGB

Hi,
I'm having an issue where database queries via ProxySQL to a PostgreSQL database fail after a period of inactivity. The following errors appear in the logs

2026-07-30 07:40:32 PgSQL_Connection.cpp:1240:fetch_result_cont(): [ERROR] Failed to consume input. [P0001] server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
2026-07-30 07:40:32 PgSQL_Connection.cpp:1284:flush(): [ERROR] Failed to flush data to backend. [P0001] server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
2026-07-30 07:40:32 PgSQL_Session.cpp:2862:handler_minus1_ClientLibraryError(): [ERROR] Detected a broken connection while running query on (0,server.loc,5433,0) , FD (Conn:72 , MyDS:72) , user admin , last_used 46342ms ago : P0001, Failed to synchronize connection

pgsql-ping_interval_server_msec is set to 2 minutes, but I don't see any connections to the database during idle.

Looking at the code it seems like the handler in the async_ping function has been commented out:

default:
//handler(event);
async_state_machine = ASYNC_PING_SUCCESSFUL;
break;

ProxySQL version 3.0.9-618-g7ddb3dc
OS Version SUSE Linux Enterprise Server 15 SP7

proxysql.log

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