Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak DB pooling #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Tweak DB pooling #17

wants to merge 1 commit into from

Conversation

garncarz
Copy link
Owner

@garncarz garncarz commented Nov 7, 2018

Trying to solve #15.

@garncarz garncarz self-assigned this Nov 7, 2018
@garncarz garncarz force-pushed the fix_db_pooling branch 2 times, most recently from 35f6590 to 176d5f5 Compare November 9, 2018 00:54
@garncarz
Copy link
Owner Author

garncarz commented Nov 9, 2018

create_engine(..., pool_pre_ping=True) didn't prove helpful.

@garncarz
Copy link
Owner Author

Unfortunately, changing sqlalchemy.pool.QueuePool to sqlalchemy.pool.NullPool also doesn't seem to help with issues like (pymysql.err.OperationalError) (2006, "MySQL server has gone away (BrokenPipeError(32, 'Broken pipe'))") and (pymysql.err.OperationalError) (2013, 'Lost connection to MySQL server during query'). There's always a few (of both of them) every day.

@garncarz
Copy link
Owner Author

It seems to be originating solely from ./app.py --master, so if I move db_session.remove() to the end of a request (instead of calling it first to clean the previous possibly "dirty" state), it could help releasing connections, not keeping them till timeout from the DB side.

@garncarz
Copy link
Owner Author

Or no, there actually can be a dirty DB session state if a previous request wasn't somehow successful, so some cleaning should be done. But in that case I can expect the connection to fail on being time-outed, so I can ignore exceptions of that kind at that place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant