Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-06-30 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  aaugustin
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.6
  (models, ORM)  |   Resolution:  wontfix
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  mysql|  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by aaugustin):

 * status:  new => closed
 * resolution:   => wontfix


Comment:

 Cool. Thanks for taking the time to investigate and report your results!

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.22db712ee7e6a5a168ba4dda58dcebef%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-06-30 Thread Django
#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:  Normal   | 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):

 We closed the connection at the beginning of the view, not at the
 beginning of the request. So, presumably, the timeout happened inside a
 middleware but it didn't bubble up before the first query in the view.
 We ended up increasing wait_timeout (we kept it at a fairly low value as
 we had a large number of sleeping queries) and that solved the issue.

 As far as I'm concerned I think that is exactly the expected behavior and
 as such the ticket can be closed.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.764ce820c7786275aeae20d5f1e728d0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-06-26 Thread Django
#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:  Normal   | Triage Stage:  Accepted
 Keywords:  mysql|  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by aaugustin):

 * severity:  Release blocker => Normal


Comment:

 It has been suggested to call close_if_unusable_or_obsolete before
 handling each HTTP request. However, I don't think that makes much sense.
 If the connection to MySQL times out between two HTTP requests, you should
 either stop using persistent connections (with CONN_MAX_AGE = 0) or
 increase wait_timeout. I don't like the idea of adding overhead to Django
 to compensate for inconsistent settings.

 What I don't understand is that you tried CONN_MAX_AGE = 0 and that didn't
 help. I fail to see why closing the connection before each request would
 help if closing it after each request does nothing. Theoretically closing
 after a request is a safer behavior than closing before the next request
 -- you never run into timeouts. Could you double-check your tests?

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.d68a1be68514fd8f44a10be4054ffeda%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-06-26 Thread Django
#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|
-+-
Changes (by giuliettamasina):

 * cc: markus.magnuson@… (added)


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.93c7280c92e5101ed9bff9bd116bbddf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-06-24 Thread Django
#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: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
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.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-06-24 Thread Django
#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|
-+-
Changes (by aaugustin):

 * status:  closed => new
 * resolution:  wontfix =>


Comment:

 That's a different issue and a good reason to reopen the ticket until we
 figure it out.

 Do you have any way to check if MySQL drops connections while a view
 function is executing? In that case, Django 1.5 reopens a connection
 automatically (possibly breaking transactional integrity) while Django 1.6
 raises an error.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.b24a111b1f1765870af83fb2914402e5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-06-24 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  aaugustin
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.6
  (models, ORM)  |   Resolution:  wontfix
 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 know I'll be hated for this, but it actually happens even for regular
 web queries. We installed 1.6.5 on one of our production servers yesterday
 and we received a hundred or so tracebacks from some of our views. I can't
 do the math, but it's probably less then 1%. Still, with 1.5 we had no
 issues.

 To give you an idea, the problem arises both from select and insert
 statements. They could take maybe fractions of second. I triple checked
 MySql variables and `wait_timeout` is 28800, while `connection_timeout` is
 10 seconds (which, by the way, should raise a `Lost connection to MySQL
 server`).

 I tried switching from `CONN_MAX_AGE = 0` to `CONN_MAX_AGE  = 2` and
 nothing changed, so maybe it's not related with the new persistent
 connection mechanism.

 The traceback is slightly different from the one in comment 19:


 {{{
 Traceback (most recent call last):

   [...]

   File "/home/django/VIRTUALENVS/multi/lib/python2.7/site-
 packages/django/db/models/query.py", line 96, in __iter__
 self._fetch_all()

   File "/home/django/VIRTUALENVS/multi/lib/python2.7/site-
 packages/django/db/models/query.py", line 857, in _fetch_all
 self._result_cache = list(self.iterator())

   File "/home/django/VIRTUALENVS/multi/lib/python2.7/site-
 packages/django/db/models/query.py", line 220, in iterator
 for row in compiler.results_iter():

   File "/home/django/VIRTUALENVS/multi/lib/python2.7/site-
 packages/django/db/models/sql/compiler.py", line 713, in results_iter
 for rows in self.execute_sql(MULTI):

   File "/home/django/VIRTUALENVS/multi/lib/python2.7/site-
 packages/django/db/models/sql/compiler.py", line 786, in execute_sql
 cursor.execute(sql, params)

   File "/home/django/VIRTUALENVS/multi/lib/python2.7/site-
 packages/django/db/backends/util.py", line 53, in execute
 return self.cursor.execute(sql, params)

   File "/home/django/VIRTUALENVS/multi/lib/python2.7/site-
 packages/django/db/utils.py", line 99, in __exit__
 six.reraise(dj_exc_type, dj_exc_value, traceback)

   File "/home/django/VIRTUALENVS/multi/lib/python2.7/site-
 packages/django/db/backends/util.py", line 53, in execute
 return self.cursor.execute(sql, params)

   File "/home/django/VIRTUALENVS/multi/lib/python2.7/site-
 packages/django/db/backends/mysql/base.py", line 124, in execute
 return self.cursor.execute(query, args)

   File "/home/django/VIRTUALENVS/multi/lib/python2.7/site-
 packages/MySQLdb/cursors.py", line 205, in execute
 self.errorhandler(self, exc, value)

   File "/home/django/VIRTUALENVS/multi/lib/python2.7/site-
 packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
 raise errorclass, errorvalue

 OperationalError: (2006, 'MySQL server has gone away')
 }}}

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.79dfbec9b1cdb3ed0b23bfcd0172ed12%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-06-07 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  aaugustin
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.6
  (models, ORM)  |   Resolution:  wontfix
 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|
-+-
Description changed by aaugustin:

Old description:

> '''EDIT -- THE SOLUTION TO THIS PROBLEM IS EXPLAINED IN
> [https://code.djangoproject.com/ticket/21597#comment:29 COMMENT 29]. JUST
> DO WHAT IT SAYS. THANK YOU!'''
>
> 
>
> In django 1.6, when the wait_timeout passed (of mysql), then DB access
> cause the (2006, 'MySQL server has gone away') error.
> This was not the case in django 1.5.1
>
> I've noticed this error when using workers that run the django code
> (using gearman).
>
> To reproduce:
>
> Set the timeout to low value by editing /etc/mysql/my.cnf
> add the following under [mysqld]
>
> wait_timeout= 10
> interactive_timeout = 10
>
> Then
>
> {{{
> % python manage.py shell
>
> >>> # access DB
> >>> import django.contrib.auth.models
> >>> print list(django.contrib.auth.models.User.objects.all())
> >>> import time
> >>> time.sleep(15)
> >>> print list(django.contrib.auth.models.User.objects.all())
> }}}
>
> Now you get the error.
>
> Simple solution I found on the web is to call
> django.db.close_connection() before the access
>
> {{{
> >>> import django.db
> >>> django.db.close_connection()
> >>> print list(django.contrib.auth.models.User.objects.all())
> }}}
> works ok.

New description:

 '''EDIT -- THE SOLUTION TO THIS PROBLEM IS EXPLAINED IN
 [https://code.djangoproject.com/ticket/21597#comment:29 COMMENT 29]. JUST
 DO WHAT IT SAYS. THANK YOU! '''

 

 In django 1.6, when the wait_timeout passed (of mysql), then DB access
 cause the (2006, 'MySQL server has gone away') error.
 This was not the case in django 1.5.1

 I've noticed this error when using workers that run the django code (using
 gearman).

 To reproduce:

 Set the timeout to low value by editing /etc/mysql/my.cnf
 add the following under [mysqld]

 wait_timeout= 10
 interactive_timeout = 10

 Then

 {{{
 % python manage.py shell

 >>> # access DB
 >>> import django.contrib.auth.models
 >>> print list(django.contrib.auth.models.User.objects.all())
 >>> import time
 >>> time.sleep(15)
 >>> print list(django.contrib.auth.models.User.objects.all())
 }}}

 Now you get the error.

 Simple solution I found on the web is to call django.db.close_connection()
 before the access

 {{{
 >>> import django.db
 >>> django.db.close_connection()
 >>> print list(django.contrib.auth.models.User.objects.all())
 }}}
 works ok.

--

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.44281cefcc243a45709dfe728bb29669%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-06-07 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  aaugustin
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.6
  (models, ORM)  |   Resolution:  wontfix
 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|
-+-
Description changed by aaugustin:

Old description:

> In django 1.6, when the wait_timeout passed (of mysql), then DB access
> cause the (2006, 'MySQL server has gone away') error.
> This was not the case in django 1.5.1
>
> I've noticed this error when using workers that run the django code
> (using gearman).
>
> To reproduce:
>
> Set the timeout to low value by editing /etc/mysql/my.cnf
> add the following under [mysqld]
>
> wait_timeout= 10
> interactive_timeout = 10
>
> Then
>
> {{{
> % python manage.py shell
>
> >>> # access DB
> >>> import django.contrib.auth.models
> >>> print list(django.contrib.auth.models.User.objects.all())
> >>> import time
> >>> time.sleep(15)
> >>> print list(django.contrib.auth.models.User.objects.all())
> }}}
>
> Now you get the error.
>
> Simple solution I found on the web is to call
> django.db.close_connection() before the access
>
> {{{
> >>> import django.db
> >>> django.db.close_connection()
> >>> print list(django.contrib.auth.models.User.objects.all())
> }}}
> works ok.

New description:

 '''EDIT -- THE SOLUTION TO THIS PROBLEM IS EXPLAINED IN
 [https://code.djangoproject.com/ticket/21597#comment:29 COMMENT 29]. JUST
 DO WHAT IT SAYS. THANK YOU!'''

 

 In django 1.6, when the wait_timeout passed (of mysql), then DB access
 cause the (2006, 'MySQL server has gone away') error.
 This was not the case in django 1.5.1

 I've noticed this error when using workers that run the django code (using
 gearman).

 To reproduce:

 Set the timeout to low value by editing /etc/mysql/my.cnf
 add the following under [mysqld]

 wait_timeout= 10
 interactive_timeout = 10

 Then

 {{{
 % python manage.py shell

 >>> # access DB
 >>> import django.contrib.auth.models
 >>> print list(django.contrib.auth.models.User.objects.all())
 >>> import time
 >>> time.sleep(15)
 >>> print list(django.contrib.auth.models.User.objects.all())
 }}}

 Now you get the error.

 Simple solution I found on the web is to call django.db.close_connection()
 before the access

 {{{
 >>> import django.db
 >>> django.db.close_connection()
 >>> print list(django.contrib.auth.models.User.objects.all())
 }}}
 works ok.

--

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.36712e9903bf59563c604dfe621bf281%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-06-07 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  aaugustin
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.6
  (models, ORM)  |   Resolution:  wontfix
 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 aaugustin):

 I already answered in comment 29.

 If people read answers instead of asking the same question again and
 again, it would remain more visible.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.3cae58eacb6f0a279ea9ca9d40ee10fa%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-06-07 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  aaugustin
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.6
  (models, ORM)  |   Resolution:  wontfix
 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 pembo13):

 What is the correct solution for management commands that may take longer
 than the regular web queries? This issue was closed with more questions
 than answers.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.cf37dc3880c1bc2314bf9b101522c6dd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-05-30 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  aaugustin
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.6
  (models, ORM)  |   Resolution:  wontfix
 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 aaugustin):

 I believe this patch breaks the transactional integrity guarantees made by
 `transaction.atomic`.

 Django mustn't attempt to reconnect until the connection has been dropped
 properly, possibly after waiting for the exit of an atomic block.

 (Yes, I've just copy-pasted comment 20, because that's the answer to all
 naive reconnection attempts. If this bug was that easy to fix, I would
 have done it.)

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.70371ffbe0b2fa974e93ef649a594746%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-05-29 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  aaugustin
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.6
  (models, ORM)  |   Resolution:  wontfix
 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|
-+-
Changes (by victorgama):

 * cc: victorgama (added)


Comment:

 I just opened an pull request that may address this issue:
 https://github.com/django/django/pull/2740
 @aaugustin can you review it?

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.32dc73589089866db81fcafe3d1eddda%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-05-20 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  aaugustin
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.6
  (models, ORM)  |   Resolution:  wontfix
 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 jeroen.pulles@…):

 My preferred solution is to increase the wait_timeout to 86400 (24hr) on
 sessions from processes that are long lived. Otherwise I have to do a
 close before any blocking call to other systems, e.g. redis, which may
 block for a month or return in a split second. These blocking calls are
 mostly in loops; Under load they are repeatedly called. I am not about to
 add a connection.close() call in those code paths. (And this is where the
 MySQL reconnect behavior worked fine, it only kicked in whén there was a
 timeout).

 http://dev.mysql.com/doc/refman/5.6/en/auto-reconnect.html

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.11646fa3cd1235705bfe6746afa72e30%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-05-15 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  aaugustin
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.6
  (models, ORM)  |   Resolution:  wontfix
 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 pembo13):

 Could someone give a little more context to this issue? I ran into it the
 very first morning after upgrading from 1.5.x to 1.6.x, I am guessing
 because the app saw no use for a few hours (2am to 8am). I had
 'CONN_MAX_AGE' set to 15mins, but have had wait_timeout and
 interactive_timeout set to 5mins.

 So in my case, I don't exactly know my program is going to be idle for a
 long time, though my wait_timeout didn't seem that low. I've preemptively
 adjusted my wait_timeout to 30mins and my interactive_timeout to 60mins,
 but a bit more explanation of the issue. I don't yet see the relation to
 #15119.

 Also, this issue should probably be mentioned in the docs somewhere.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.80af482eee465a79f1f4f28e9c08047f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-04-26 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  aaugustin
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.6
  (models, ORM)  |   Resolution:  wontfix
 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|
-+-
Changes (by aaugustin):

 * status:  assigned => closed
 * resolution:   => wontfix


Comment:

 Actually this is the intended behavior after #15119. See that ticket for
 the rationale.

 

 **If you hit this problem and don't want to understand what's going on,
 don't reopen this ticket, just do this:**

 - **RECOMMENDED SOLUTION: close the connection with `from django.db import
 connection; connection.close()` when you know that your program is going
 to be idle for a long time.**
 - ''CRAPPY SOLUTION: increase wait_timeout so it's longer than the maximum
 idle time of your program.''

 In this context, idle time is the time between two successive database
 queries.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.18c5d1cdaec19f029fdca8a2806ac18b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-04-25 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  aaugustin
 Type:  Bug  |   Status:  assigned
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|
-+-
Changes (by aaugustin):

 * owner:  err => aaugustin


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.ce1e616bb24fa53794aa141c7b8bb144%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-04-25 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  err
 Type:  Bug  |   Status:  assigned
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 aaugustin):

 My biggest problem is that I have no idea why this worked on 1.5.x :(

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.fafd31158aaf01979acd13e69297ae74%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-04-23 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  err
 Type:  Bug  |   Status:  assigned
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 matteius@…):

 Having the same problem in Django 1.6.3 in a process that is run
 indefinitely via a management command.   I am attempting a build now where
 at the start of each loop I call:

 db.close_old_connections()

 We'll see if this solves the problem or not.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.88c245c10b15cd64a3767ca82e1de486%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-04-16 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  err
 Type:  Bug  |   Status:  assigned
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 jazeps.basko@…):

 Maybe this helps someone like me who uses Django and SQLAlchemy. I was
 experiencing this problem every morning with an API (not used for several
 hours at night) which had `CONN_MAX_AGE=3600` and MySQL server with
 `wait_timeout = 28800`. I even changed settings which are used by
 `manage.py` (to run migrations and collect static assets) to not use
 persistent connections `CONN_MAX_AGE=0`, but the problem persisted. Then I
 noticed that this is actually happening in the code where SQLAlchemy
 accesses DB, so I googled and found this post:
 http://nathansnoggin.blogspot.co.uk/2013/11/integrating-sqlalchemy-into-
 django.html  Followed the instructions in the blog post. Now that my
 SQLAlchemy does not handle connections (just uses whatever Django
 supplies) the problem is gone.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.2cd5116d8419a4f1005f401e1c8aad8b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-04-10 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  err
 Type:  Bug  |   Status:  assigned
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 anonymous):

 Replying to [comment:22 aaugustin]:
 > Unless I missed something, this only affects people that have management
 commands running for more than 8 hours (or MySQL's connection timeout if
 it has been changed from the default). Is that correct?
 As far as I can tell I think this is correct. At least this is the place
 where I was hitting this bug in my environment (before downgrading to 1.5
 again because of this).

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.4f801b5e70e8554f5b44b53dd504a171%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-04-08 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  err
 Type:  Bug  |   Status:  assigned
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 andreis):

 Hi, this absolutely true for me. However I've managed to come up with a
 workaround, we've wrapped some of our code with decorators which
 implicitly call close_old_connections() routine, so that django now
 respects CONN_MAX_AGE parameter to some extent.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.74de2f108a2757c328ea29ea179e14c1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-04-07 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  err
 Type:  Bug  |   Status:  assigned
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|
-+-
Changes (by aaugustin):

 * severity:  Normal => Release blocker


Comment:

 Unless I missed something, this only affects people that have management
 commands running for more than 8 hours (or MySQL's connection timeout if
 it has been changed from the default). Is that correct?

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.8444adc0b11409721652929b046ae998%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-04-07 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  err
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  1.6
  (models, ORM)  |   Resolution:
 Severity:  Normal   | 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 anonymous):

 A fix for this is still badly required, as this is a horrible
 '''regression'''. Please mark this bug as a release blocker, as it
 breaks existing code and makes upgrading to Django 1.6 impossible for
 quite a few people.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.65b19426bc07b52df7ad99fc67ad2a6a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-03-25 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  err
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  1.6
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  mysql|  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by aaugustin):

 * needs_better_patch:  0 => 1


Comment:

 I believe this patch breaks the transactional integrity guarantees made by
 `transaction.atomic`.

 Django mustn't attempt to reconnect until the connection has been dropped
 properly, possibly after waiting for the exit of an atomic block.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.c3c803234b2874b7c9115bc296704e75%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-03-25 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  err
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  1.6
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  mysql|  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by timo):

 * cc: timo (added)
 * has_patch:  0 => 1


Comment:

 When I run the MySQL tests using djangocore-box, I get the traceback below
 when the test suite concludes. The PR above resolves this error.
 {{{
 Traceback (most recent call last):
   File "/django/tests/runtests.py", line 374, in 
 options.failfast, args)
   File "/django/tests/runtests.py", line 216, in django_tests
 test_labels or get_installed(), extra_tests=extra_tests)
   File "/django/django/test/runner.py", line 149, in run_tests
 self.teardown_databases(old_config)
   File "/django/django/test/runner.py", line 124, in teardown_databases
 connection.creation.destroy_test_db(old_name, self.verbosity)
   File "/django/django/db/backends/creation.py", line 452, in
 destroy_test_db
 self._destroy_test_db(test_database_name, verbosity)
   File "/django/django/db/backends/creation.py", line 466, in
 _destroy_test_db
 % self.connection.ops.quote_name(test_database_name))
   File "/django/django/db/backends/utils.py", line 59, in execute
 return self.cursor.execute(sql, params)
   File "/django/django/db/utils.py", line 94, in __exit__
 six.reraise(dj_exc_type, dj_exc_value, traceback)
   File "/django/django/db/backends/utils.py", line 57, in execute
 return self.cursor.execute(sql)
   File "/django/django/db/backends/mysql/base.py", line 128, in execute
 return self.cursor.execute(query, args)
   File "/home/vagrant/.virtualenvs/py2.7/local/lib/python2.7/site-
 packages/MySQLdb/cursors.py", line 174, in execute
 self.errorhandler(self, exc, value)
   File "/home/vagrant/.virtualenvs/py2.7/local/lib/python2.7/site-
 packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
 raise errorclass, errorvalue
 django.db.utils.OperationalError: (2006, 'MySQL server has gone away')
 }}}

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.fdfb702e30827e1221003267a26f1904%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-03-21 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  err
 Type:  Bug  |   Status:  assigned
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 err):

 https://github.com/django/django/pull/2454 I've submitted pull request

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.65709412bfb6ce5d65dc2e688386be42%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-03-21 Thread Django
#21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout 
passed
-+-
 Reporter:  ekeydar@…|Owner:  err
 Type:  Bug  |   Status:  assigned
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|
-+-
Changes (by err):

 * owner:  nobody => err
 * status:  new => assigned


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.b762ab7b3ab38eca6355f8d9c856280d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-03-19 Thread Django
#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@…):

 I've checked with my existing long running processes on Django 1.5
 installations, running the same mysql-python and libmysqlclient.so, with
 tcpdump:

 They do set the interactive flag on the MySQL connection. That explains
 for me why I never experienced the Gone Away's before. Django doesn't
 notice that the underlying connection went away and came back.

 I haven't had enough time to find out (dig down deep enough) what makes
 this flag appear on the connection in the 1.5 situation and what changed
 in 1.6 that is relevant to this problem. (a) My suspicion is that it isn't
 directly related to the connection persistence mechanism. (b) To me it
 doesn't seem to be in any way related to the transactions mechanisms: My
 transactions happen fast enough and it's fine that things break if the
 transaction takes longer than wait_timeout (e.g. more than two minutes);
 The same application that works fine in 1.5 also works in 1.6 with the
 interactive flag set.

 JeroenP

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.b2586ecd8514ce14b1f4c3d758d6776e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-03-18 Thread Django
#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 andreis):

 Hey folks! Any thought on this matter?

 Thanks

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.0846ff1820905b30e8dd788d9ff17030%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-02-11 Thread Django
#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 andreis):

 Hi Jeroen!
 It seems like adding CLIENT.INTERACTIVE flag just tells the driver to
 switch from checking on wait_timeout to taking interactive_timeout into
 account. I set interactive_timeout=10 and was able to reproduce this
 problem.
 Both of these values are 8 hours by default, but once your code has been
 inactive for that long, mysql drops the connection and the client fails
 next time it tries to access some data. It looks perfectly right to catch
 this error in the code, call django.db.close_connection() every time or
 whatever, but I think that maybe connection persistence logic needs a bit
 of fine-tuning so that we can control persistence without relying on
 signals.request_started/request_finished.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.1eeb01f9757990eba69f4a85b53330e6%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-02-11 Thread Django
#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: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
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.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-02-10 Thread Django
#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 andreis):

 Hi,
 to me it seems to be a bug. Old django would close every connection right
 away, django 1.6 checks with CONN_MAX_AGE:
 1. It gets CONN_MAX_AGE from DATABASES, sets close_at:

 {{{
 max_age = self.settings_dict['CONN_MAX_AGE']
 self.close_at = None if max_age is None else time.time() + max_age
 }}}

 2. Actually the code above affects close_if_unusable_or_obsolete, which
 closes the connection if 'self.close_at is not None and time.time() >=
 self.close_at'
 3. close_if_unusable_or_obsolete itself is being called by
 close_old_connections, which in turn is a request handler for
 signals.request_started and signals.request_finished.

 We have a worker, which is effectively a django app but but it doesn't
 process any HTTP requests. In fact that makes all connections persistent
 because close_old_connections never gets called.

 Please advise.

 Thanks

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.67b7649e7bf3e036bf981c2cfb24a0a3%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-01-23 Thread Django
#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 err):

 or even close connection (if not usable) in ensure_connection

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.4de55e78daf8e86500b5d720323bd0c5%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2014-01-23 Thread Django
#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 err):

 Maybe we can validate that connection is usable in
 '''ensure_connection''' ?

 something like this:

 {{{
 *** Django-1.6.1/django/db/backends/__init__.py 2014-01-23
 16:57:15.927687924 +0400
 --- /usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py
 2014-01-23 16:56:21.0 +0400
 ***
 *** 119,125 
   """
   Guarantees that a connection to the database is established.
   """
 ! if self.connection is None or not self.is_usable():
   with self.wrap_database_errors:
   self.connect()

 --- 119,125 
   """
   Guarantees that a connection to the database is established.
   """
 ! if self.connection is None:
   with self.wrap_database_errors:
   self.connect()
 }}}

 are there any caveats?

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.5a1023dee3eaaaf8b94c267e959aaeb4%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2013-12-19 Thread Django
#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 aigarius):

 For now we are using the following workaround for long-running workers:

 {{{
 from django.db import connection
 ...
 def is_connection_usable():
 try:
 connection.connection.ping()
 except:
 return False
 else:
 return True
 ...

 def do_work():
 while(True): # Endless loop that keeps the worker going (simplified)
 if not is_connection_usable():
 connection.close()
 try:
 do_a_bit_of_work()
 except:
 logger.exception("Something bad happened, trying again")
 sleep(1)
 }}}

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.3bc5548a0b64cd2d884f40e4f719cf7b%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2013-12-18 Thread Django
#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 aigarius):

 Could this actually be a failure to re-establish a connection to MySQL
 after receiving the 2006 error? I get the same symptoms in production now
 when a MySQL server is restarted - all workers start getting 2006 errors
 and do not recover. Only gunicorn restart helps then. You could reproduce
 it locally by calling "print
 list(django.contrib.auth.models.User.objects.all())" every second and then
 restarting MySQL server. The connection does not recover even after the
 server is back up and accepting connections. This was tested with
 CONN_MAX_AGE > 0 but lower than wait_timeout on the MySQL server.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.ffd625d95b33d38aa6c479ad02a91bb7%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2013-12-13 Thread Django
#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 claudep):

 Query comparison (as in OP example, without using `transaction.atomic()`):
 {{{
 #!html
 
 Django 1.5Django 1.6
 562 Connectroot@localhost on test_
 562 Query   SET NAMES utf8
 562 Query   set autocommit=0
 562 Query   SET SQL_AUTO_IS_NULL = 0


 562 Query   SELECT `auth_user`.`id`, ... FROM `auth_user`

 563 Connect root@localhost on test_
 563 Query   SET NAMES utf8
 563 Query   set autocommit=0
 563 Query   SET SQL_AUTO_IS_NULL = 0

 563 Query   SELECT `auth_user`.`id`,... FROM `auth_user`
 560 Connectroot@localhost on test_
 560 Query   SET NAMES utf8
 560 Query   set autocommit=0
 560 Query   SET SQL_AUTO_IS_NULL = 0
 560 Query   set autocommit=1
 560 Query   set autocommit=0
 560 Query   SELECT `auth_user`.`id`, ... FROM `auth_user`

 561 Connect root@localhost on test_
 561 Query   SET NAMES utf8
 561 Query   set autocommit=0
 561 Query   SET SQL_AUTO_IS_NULL = 0
 561 Query   set autocommit=1
 561 Query   SELECT `auth_user`.`id`, ... FROM
 `auth_user`
 
 }}}

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.786baab7b109177c488df049f52aff2c%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2013-12-12 Thread Django
#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|
-+-
Changes (by claudep):

 * stage:  Unreviewed => Accepted


Comment:

 @aaugustin: even with `transaction.atomic()` (as of comment:3), I'm able
 to reproduce the failure.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.b300a45265ea97887cd341d5ee989a4c%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2013-12-12 Thread Django
#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:
 Keywords:  mysql|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by claudep):

 AFAIK the default timeout on MySQL is 28800 seconds (8 hours).
 http://dev.mysql.com/doc/refman/5.5/en/server-system-
 variables.html#sysvar_wait_timeout

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.54305f1516d2d4263cde35becdcd0652%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2013-12-12 Thread Django
#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:
 Keywords:  mysql|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by anonymous):

 I ran into the same issue after upgrading to Django 1.6. In my case it
 affects long-running (multiple days) WorkerThreads, although I am **not**
 using any ''wait_timeout'' setting. It looks like the connection just
 times out without Django noticing/handling it.

 Code which is triggering this:


 {{{
 cursor = connections['legacydb'].cursor()
 cursor.execute(query)
 result = cursor.fetchall()
 cursor.close()
 }}}

 The above code works for a few hours and after a while the
 OperationalError 2006 is triggered on ''cursor.execute()''. This behavior
 was not present in early Django versions and is a critical **regression**
 (aka: code which used to work now raises an Exception → severity should be
 set to **release blocker**).

 BTW: The ''legacydb'' in the example does not support transactions
 (MyISAM).

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.427dfbfd8916be57959ee6e44850bf59%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2013-12-12 Thread Django
#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:
 Keywords:  mysql|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Old description:

> In django 1.6, when the wait_timeout passed (of mysql), then DB access
> cause the (2006, 'MySQL server has gone away') error.
> This was not the case in django 1.5.1
>
> I've noticed this error when using workers that run the django code
> (using gearman).
>
> To reproduce:
>
> Set the timeout to low value by editing /etc/mysql/my.cnf
> add the following under [mysqld]
>
> wait_timeout= 10
> interactive_timeout = 10
>
> Then
> % python manage.py shell
>
> >>> # access DB
> >>> import django.contrib.auth.models
> >>> print list(django.contrib.auth.models.User.objects.all())
> >>> import time
> >>> time.sleep(15)
> >>> print list(django.contrib.auth.models.User.objects.all())
>
> Now you get the error.
>
> Simple solution I found on the web is to call
> django.db.close_connection() before the access
> >>> import django.db
> >>> django.db.close_connection()
> >>> print list(django.contrib.auth.models.User.objects.all())
> works ok.

New description:

 In django 1.6, when the wait_timeout passed (of mysql), then DB access
 cause the (2006, 'MySQL server has gone away') error.
 This was not the case in django 1.5.1

 I've noticed this error when using workers that run the django code (using
 gearman).

 To reproduce:

 Set the timeout to low value by editing /etc/mysql/my.cnf
 add the following under [mysqld]

 wait_timeout= 10
 interactive_timeout = 10

 Then

 {{{
 % python manage.py shell

 >>> # access DB
 >>> import django.contrib.auth.models
 >>> print list(django.contrib.auth.models.User.objects.all())
 >>> import time
 >>> time.sleep(15)
 >>> print list(django.contrib.auth.models.User.objects.all())
 }}}

 Now you get the error.

 Simple solution I found on the web is to call django.db.close_connection()
 before the access

 {{{
 >>> import django.db
 >>> django.db.close_connection()
 >>> print list(django.contrib.auth.models.User.objects.all())
 }}}
 works ok.

--

Comment (by aaugustin):

 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 in that case.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.5ba219464eaa498548eaf9c17061d48e%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2013-12-12 Thread Django
#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:
 Keywords:  mysql|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by ekeydar@…):

 Not using this.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.7e3e550ebfa9a6a44f34c3afed600c07%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21597: (2006, 'MySQL server has gone away') in django1.6 when wait_timeout passed

2013-12-12 Thread Django
#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:
 Keywords:  mysql|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by aaugustin):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 Are you using persistent connections (CONN_MAX_AGE > 0)?

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.88b909f6062608c65e05450bc9ad7d6d%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.