Changes between Initial Version and Version 3 of Ticket #21597


Ignore:
Timestamp:
Dec 12, 2013, 4:45:10 AM (11 years ago)
Author:
Aymeric Augustin
Comment:

This might be a side effect of using autocommit. Since Django 1.5 kept a transaction open in that case, MySQL couldn't close the connection. Now it can.

Could you try the following snippet to confirm my hypothesis?

>>> import django.contrib.auth.models
>>> from django.db import transaction
>>> with transaction.atomic():
...     print list(django.contrib.auth.models.User.objects.all())
...     import time
...     time.sleep(15)
...     print list(django.contrib.auth.models.User.objects.all())

You shouldn't get a timeout when you run this on Django 1.6.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #21597 – Description

    initial v3  
    1313
    1414Then
     15
     16{{{
    1517% python manage.py shell
    1618
     
    2123>>> time.sleep(15)
    2224>>> print list(django.contrib.auth.models.User.objects.all())
     25}}}
    2326
    2427Now you get the error.
    2528
    2629Simple solution I found on the web is to call django.db.close_connection() before the access
     30
     31{{{
    2732>>> import django.db
    2833>>> django.db.close_connection()
    2934>>> print list(django.contrib.auth.models.User.objects.all())
     35}}}
    3036works ok.
Back to Top