#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: <https://code.djangoproject.com/ticket/21597#comment:9>
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 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.

Reply via email to