Malcolm,

I'm having exactly the same problem.
Under Apache+mod_python, each HTTP request keeps a stale MySQL
connection.

I traced the changeset, it was 5481->4582.

I put some logging to django.db.backends.mysql.base:

....
  self.connection = Database.connect(**kwargs)
+ log.msg("connected to %s" % self.connection)
....
+ log.msg("closed %s" % self.connection)
  self.connection.close()
....

The output was (for 2 HTTP requests):
2007/06/20 19:56 NOVST [-] Log opened.
2007/06/20 19:56 NOVST [-] connected to <_mysql.connection open to
'localhost' at 867f5ec>
2007/06/20 19:56 NOVST [-] closed <_mysql.connection open to
'localhost' at 867f5ec>
2007/06/20 19:56 NOVST [-] connected to <_mysql.connection open to
'localhost' at 86c8af4>
2007/06/20 19:56 NOVST [-] connected to <_mysql.connection open to
'localhost' at 87fa7dc>
2007/06/20 19:56 NOVST [-] closed <_mysql.connection open to
'localhost' at 87fa7dc>
2007/06/20 19:56 NOVST [-] connected to <_mysql.connection open to
'localhost' at 8829fe4>

You see, 2 connections are opened and only 1 is closed per request.

As the result, there were two sleeping stale MySQL connections (output
of SHOW PROCESSLIST)
| 907 | root | localhost | corp2 | Sleep   |    5 |       |
NULL             |
| 909 | root | localhost | corp2 | Sleep   |    2 |       |
NULL             |

(Note the IDs had a gap between them).

If you have no time and/or can't reproduce the problem, I will try to
trace further and hopefully come up with a patch.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to