#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout
passed
-------------------------------------+-------------------------------------
Reporter: ekeydar@… | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.6
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: mysql | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by jeroen.pulles@…):
Hi,
Without transactions you hit the Gone Away if the sleep is longer than
MySQL's wait_timeout:
{{{
mysql> set global wait_timeout=10;
}}}
{{{
>>> import django.contrib.auth.models
>>> import time
>>> print list(django.contrib.auth.models.User.objects.all())
>>> time.sleep(15)
>>> print list(django.contrib.auth.models.User.objects.all())
}}}
According to MySQL/python documentation this should not be a problem. If
you add the INTERACTIVE bit to the client connection flags in
db/backends/mysql/base.py, you regain the MySQL drivers' auto-reconnect
feature and everything works as before (I think that in Django 1.5 you ran
into trouble with a transaction that ran longer than wait_timeout too).
from {{{ kwargs['client_flag'] = CLIENT.FOUND_ROWS }}}
to {{{ kwargs['client_flag'] = CLIENT.FOUND_ROWS | CLIENT.INTERACTIVE }}}
I haven't looked into the origins of this line, but maybe it is the real
culprit for the recent Gone Away issues.
--
Ticket URL: <https://code.djangoproject.com/ticket/21597#comment:13>
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.82006f465ed66829987b10df6f323dc2%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.