Skip to content

pg.on('error') does not remove client idle timers #130

Closed
@troyk

Description

@troyk

I'm listening to pg.on('error') and terminate the clients server process (to simulate restarting the server). The error fires and the client passed to the error has an empty queryQueue.

A few moments after the error, the following process level error is thrown:

timers.js:96
            if (!process.listeners('uncaughtException').length) throw e;
                                                                      ^
Error: This socket is closed.
    at Socket._write (net.js:453:28)
    at Socket.write (net.js:446:15)
    at [object Object]._send (/Users/troy/Projects/blit.js/node_modules/pg/lib/connection.js:102:24)
    at [object Object].end (/Users/troy/Projects/blit.js/node_modules/pg/lib/connection.js:206:8)
    at [object Object].end (/Users/troy/Projects/blit.js/node_modules/pg/lib/client.js:211:19)
    at Object.destroy (/Users/troy/Projects/blit.js/node_modules/pg/lib/index.js:76:14)
    at Object.destroy (/Users/troy/Projects/blit.js/node_modules/pg/node_modules/generic-pool/lib/generic-pool.js:123:13)
    at Object.removeIdle [as _onTimeout] (/Users/troy/Projects/blit.js/node_modules/pg/node_modules/generic-pool/lib/generic-pool.js:148:12)
    at Timer.ontimeout (timers.js:94:19)

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