MySQL has gone away errors...

58 views
Skip to first unread message

Parnell Springmeyer

unread,
May 6, 2012, 8:48:42 PM5/6/12
to pylons-...@googlegroups.com
I'm getting a lot of "MySQL Server has gone away" errors lately and I've done everything I could in threads discussing this issue that I could find through google.

I have pool, pool recycle, and max overflow set... Is there something I'm missing? Or maybe it's the DB being hit really hard, or maybe a DB configuration option???

--
Parnell "ixmatus" Springmeyer (http://ixmat.us)

Randall Leeds

unread,
May 7, 2012, 12:51:17 AM5/7/12
to pylons-...@googlegroups.com
On Sun, May 6, 2012 at 5:48 PM, Parnell Springmeyer <ixm...@gmail.com> wrote:
> I'm getting a lot of "MySQL Server has gone away" errors lately and I've
> done everything I could in threads discussing this issue that I could find
> through google.
>
> I have pool, pool recycle, and max overflow set... Is there something I'm
> missing? Or maybe it's the DB being hit really hard, or maybe a DB
> configuration option???

pool_recycle fixed this for me. Check with your MySQL server to find
out what the connection timeout value is.
On my hosting provider it as set to 60s. Lowering pool_recycle to
below this value fixed it for me.

>
> --
> Parnell "ixmatus" Springmeyer (http://ixmat.us)
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To post to this group, send email to pylons-...@googlegroups.com.
> To unsubscribe from this group, send email to
> pylons-discus...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pylons-discuss?hl=en.

Raoul Snyman

unread,
May 7, 2012, 12:58:56 PM5/7/12
to pylons-...@googlegroups.com
On 7 May 2012 02:48, Parnell Springmeyer <ixm...@gmail.com> wrote:
> I have pool, pool recycle, and max overflow set... Is there something I'm
> missing? Or maybe it's the DB being hit really hard, or maybe a DB
> configuration option???

I've been through this a few times, and the main cause of this is the
server not being hit enough. Then SQLAlchemy holds a bunch of
connections which MySQL has deemed "too old" and drops them from its
side.

On one site I ended up polling the DB via a cron job. Nasty hack, but
it got the job done when none of the other options described worked.

--
Raoul Snyman
B.Tech Information Technology (Software Engineering)
E-Mail:   raoul....@gmail.com
Web:      http://www.saturnlaboratories.co.za/
Blog:      http://blog.saturnlaboratories.co.za/
Mobile:   082 550 3754
Registered Linux User #333298 (http://counter.li.org)

Mike Orr

unread,
May 7, 2012, 2:46:57 PM5/7/12
to pylons-...@googlegroups.com
> On one site I ended up polling the DB via a cron job. Nasty hack, but
> it got the job done when none of the other options described worked.

I used to have a lightly-used site that would sometimes go several
days without a request, so I had cron restart the application every 8
hours.

--
Mike Orr <slugg...@gmail.com>

Parnell Springmeyer

unread,
May 7, 2012, 4:33:20 PM5/7/12
to pylons-...@googlegroups.com
I had pool_recycle set but TBH it was a value much higher than the
server's connection timeout value was at. I just changed it so we'll see
if this makes a difference!

Thank you for the input :)

Benjamin Sims

unread,
May 7, 2012, 6:02:52 PM5/7/12
to pylons-...@googlegroups.com
The hack that I used to get around this problem was to catch the exception and try the connection a second time in the first function used in each page (that loading the user in that case). This woke up the MySQL server and did the trick.

pspringmeyer

unread,
May 13, 2012, 2:09:07 PM5/13/12
to pylons-...@googlegroups.com
Sadly, this did not work for me :(


On Sunday, May 6, 2012 11:51:17 PM UTC-5, Randall Leeds wrote:
On Sun, May 6, 2012 at 5:48 PM, Parnell Springmeyer <ixm...@gmail.com> wrote:
> I'm getting a lot of "MySQL Server has gone away" errors lately and I've
> done everything I could in threads discussing this issue that I could find
> through google.
>
> I have pool, pool recycle, and max overflow set... Is there something I'm
> missing? Or maybe it's the DB being hit really hard, or maybe a DB
> configuration option???

pool_recycle fixed this for me. Check with your MySQL server to find
out what the connection timeout value is.
On my hosting provider it as set to 60s. Lowering pool_recycle to
below this value fixed it for me.

>
> --
> Parnell "ixmatus" Springmeyer (http://ixmat.us)
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To post to this group, send email to pylons-discuss@googlegroups.com.
> To unsubscribe from this group, send email to
> pylons-discuss+unsubscribe@googlegroups.com.

pspringmeyer

unread,
May 13, 2012, 2:10:27 PM5/13/12
to pylons-...@googlegroups.com
I was going to try and do this but it's being thrown in beaker when it the user first hits the site. Our app doesn't get heavy enough usage for me to move session storage over to something like memcached so I'm keeping it in the DB - I'll probably go with the "cronjob polling db every hour" solution.


On Monday, May 7, 2012 5:02:52 PM UTC-5, somewhatofftheway wrote:
The hack that I used to get around this problem was to catch the exception and try the connection a second time in the first function used in each page (that loading the user in that case). This woke up the MySQL server and did the trick.

On 7 May 2012 19:46, Mike Orr <slugg...@gmail.com> wrote:
> On one site I ended up polling the DB via a cron job. Nasty hack, but
> it got the job done when none of the other options described worked.

I used to have a lightly-used site that would sometimes go several
days without a request, so I had cron restart the application every 8
hours.

--
Mike Orr <slugg...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to pylons-discuss+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages