#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout
passed
-------------------------------------+-------------------------------------
Reporter: ekeydar@… | Owner: aaugustin
Type: Bug | Status: new
Component: Database layer | Version: 1.6
(models, ORM) | Resolution:
Severity: Release blocker | Triage Stage: Accepted
Keywords: mysql | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by germanoguerrini):
I was able to reproduce the error. First of all, while the global
`wait_timeout` was 28800, the session value was just 30 seconds.
That means the if the time between two queries in the same view is longer
than that, or if a view runs just one query but after 30 seconds from its
invocation (for example for a very long computation in a middleware or a
forced sleep) it raises the infamous `MySQL has gone away`.
For example:
{{{
def my_view(request):
import time
time.sleep(31)
print User.objects.get(pk=1)
return HttpResponse()
}}}
and I think this is the expected behavior.
The problem is that we run some pretty sophisticated monitoring
application (namely New Relic) and the longest trace I can see is a 3.5
seconds view which was probably a glitch from MySQL (it took 3.1 seconds
to select a user using his pk).
For now, we solved the most severe view error by closing the connection at
the beginning of it (forcing the creation of a new one), but I'll keep
monitoring the situation and I'll get back to you because I'm starting to
think that it has to do with our particular configuration. Django 1.6 has
been out for too long for us being the first to notice that.
--
Ticket URL: <https://code.djangoproject.com/ticket/21597#comment:40>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/075.bccd5481a5a3dea1e46f9accdeea67d8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.