Skip to content

It would be good to add some idleTimeout to pool options #962

Open
@dusmanija

Description

@dusmanija

Hello,

I am using this module for a long time but it lacks one failsafe element. My code for database functions became very big and it is hard to find where connection is not closed or if some errors happened before connection is closed that connection will stay idle and eventually when all are consumed from the pool the application hangs on database calls. It would be good to add some option like idelConnectionTimeout that will destroy a connection from a pool if it is idle for set time. This way pool will never stuck and will create fresh connections to replace those that hanged. Also if some mechanism could be made to auto close connection on end that would be great but i think that is not an option...

Activity

dougwilson

dougwilson commented on Dec 18, 2014

@dougwilson
Member

The most flexible way would be we can add an options object to the getConnection where you can say "hey, if the connection sits idle for x seconds, this is an error and kill the connection".

brendanashworth

brendanashworth commented on Dec 24, 2014

@brendanashworth

I'd like to see this feature implemented, it is quite a pain (especially with error handling) to locate a connection leak. Sometimes I resolve to refreshing each page 11 times (10 = max connections) until it dies.

seme1

seme1 commented on Feb 3, 2015

@seme1

Same here. Please implement this feature.

lroal

lroal commented on Feb 22, 2015

@lroal

This would be a nice feature.

dougwilson

dougwilson commented on Feb 22, 2015

@dougwilson
Member

PRs are welcome :)!

brendanashworth

brendanashworth commented on Apr 27, 2015

@brendanashworth

Doesn't #802 do this?

dougwilson

dougwilson commented on Apr 27, 2015

@dougwilson
Member

No

AdriVanHoudt

AdriVanHoudt commented on Feb 29, 2016

@AdriVanHoudt

+1 for this, now to find time for a PR 😃

akuma

akuma commented on Dec 5, 2016

@akuma

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @dougwilson@akuma@lroal@AdriVanHoudt@brendanashworth

      Issue actions

        It would be good to add some idleTimeout to pool options · Issue #962 · mysqljs/mysql