Skip to content

BUG: If a query fails, it never ends #1130

@Llorx

Description

@Llorx

I have this code:

try { await pg.unsafe("My query"); } catch (e) { // whatever }

The connection is inmediately lost as a test that I have is to close the server socket just when the query starts, so I'm receiving an Error: read ECONNRESET in the catch.

But when I try to end the connection, it lasts forever:

await pg.end();

I went into the code and what I found is that a connection has a rejected query associated, so it just waits for it to finish, but it is already finished, so it waits forever:

Image

Obviously I don't want to add a timeout to the end callback as a workaround. All resources should be cleaned properly.

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