#18135: Sleeping Database Connections on Startup with MySQL
-------------------------------+------------------------------------
     Reporter:  Mnewman        |                    Owner:  nobody
         Type:  Bug            |                   Status:  new
    Component:  Uncategorized  |                  Version:  1.4
     Severity:  Normal         |               Resolution:
     Keywords:  MySQL          |             Triage Stage:  Accepted
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+------------------------------------
Changes (by akaariai):

 * stage:  Unreviewed => Accepted


Comment:

 I did a little digging and the reason for the connection is that model
 validation needs to know server version, and checking server version opens
 a connection which is then not closed. So, this code in
 mysql/validation.py:
 {{{
         try:
             db_version = self.connection.get_server_version()
             text_version = '.'.join([str(n) for n in db_version[:3]])
         except OperationalError:
             db_version = None
             text_version = ''
 }}}
 seems to need some way to close the connection. I am not sure if it is
 safe to just have a "finally: close connection" in there. Maybe it should
 be checked that if there is no existing connection when entering this
 function, but there is one when leaving it, then close the created
 connection.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18135#comment:3>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to