Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

mysql pool recycle default #91

Closed
asergeyev opened this Issue Jul 27, 2012 · 3 comments

Comments

Projects
None yet
4 participants

there is default for mysql driver in flask-sqlalchemy
options.setdefault('pool_recycle', 7200)

Most servers will timeout client connection in 1 hour IMO it's better to use this as a default value and let people change it to longer times when appropriate.

(....there is another caveat right now - if your mysql server got restarted there is nothing that would catch exception and try to reconnect to serve current request, I wonder if that exception would be possible to catch in lib, not inside of the application code)

kkamkou commented Oct 8, 2015

+1 (it creates a lot of not transparent problems: for example)

Collaborator

davidism commented Oct 9, 2015

According to the Flask-SQLAlchemy docs and the SQLAlchemy docs, MySQL recycles connections every 8 hours by default, and Flask-SQLAlchemy sets this to 2 hours. I've seen plenty of questions about MySQL timeouts on SO, but I'd be more inclined to change this if you could point to a definitive statement that the default is 1 hour.

SQLAlchemy also describes some ways that connections can be invalidated. I'm not sure if these sorts of things should be worked into Flask-SQLAlchemy.

Collaborator

immunda commented Nov 25, 2015

The defaults for both interactive_timeout and wait_timeout are 8 hours. I appreciate that some folks may have providers with unusual DB configurations, but I don't think that's the responsibility of this library to solve, as it wouldn't provide a general solution.

I've also read through that SO post and whilst valid, without a running and complete configuration to be tested against, there's no way to determine whether that particular problem is even caused by this.

@immunda immunda closed this Nov 25, 2015

@eipiminus1 eipiminus1 referenced this issue in docker-library/mariadb Jul 9, 2017

Closed

Set default `wait_timeout` value to 28800 #113

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