Skip to content

Connection hang on the server side after ended #2329

Open
@zen0wu

Description

@zen0wu

Hello!

We're observing the following behavior on our servers:

  • We use pg-pool to connect to a load balanced pool of pgbouncer
  • Occasionally we see connections closed from our application, but still alive on pgbouncer side
  • This exhausted the server connections on pgbouncer machines and cause issue
  • The server connection linked to that pgbouncer connection shows it's waiting on ClientRead

This happens after we upgraded our pg from 7.4.3 to 8.3.0. And the following code stands out, which might be the cause.

3828aa86

In this commit, the Client.end() method is changed

  • Before it calls connection.end() even after destroying the stream
  • Now if there's an active query, it only destroys the stream and not end the connection

We haven't been 100% sure this is the root cause, but I wonder if this is an intentional change. Logically it seems to make sense to close that connection no matter what. Would love your thoughts on this, let me know if I have any missing context, thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions