WebFaction
Community site: login faq

I'm running a Pylons 1.0 (with python 2.6) app and continually get this error. I've set my pool recycle to 1800, which has worked on a different app on another server. However, I continually get a "MySQL server has gone away" error if the database is not accessed for a while. I've tried everything I can find, but the server does not seem to be recycling the connection like it should. Has anyone had success resolving this issue?

asked 29 Nov '10, 11:49

emplod
323
accept rate: 0%

I should have mentioned that I'm using mysql with sqlalchemy 0.6.3

(29 Nov '10, 13:00) emplod

MySQL will terminate connections that have remained idle for too long. You can work around that limitation by scheduling a cronjob to request one of your pages every hour using wget. (The page has to make a query to the database). That should prevent the connection from being terminated.

permanent link

answered 29 Nov '10, 12:19

aaronh ♦♦
1.3k3
accept rate: 34%

I agree that this should work, but it's more of a workaround than a solution. Sqlalchemy's pool recycling should take care of this automatically, but doesn't seem to be doing so.

(29 Nov '10, 12:59) emplod

Is this something you can trigger, or does it only result from an idle period with no DB access?

Does it happen consistently, like after NN minutes, every time?

Are you using the same versions of Pylons, Python, sqlalchemy, and MySQLdb (the Python library) on that other server?

(29 Nov '10, 17:00) seanf
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×337
×168
×5

question asked: 29 Nov '10, 11:49

question was seen: 4,052 times

last updated: 29 Nov '10, 17:00

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM