Opened 17 years ago
Closed 17 years ago
#4650 closed (fixed)
Since [5482], mod_python keeps a stale database connection for each HTTP request
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | ||
Cc: | ferringb@… | Triage Stage: | Unreviewed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Since [5482], a template is lazy-rendered. However under mod_python environment, the signal to close database connection (signals.request_finished) is sent before a template is actually rendered. If a connection is then reopened by demand during the rendering process, it will not be ever closed again and result in a stale connection, which soon overwhelms the database server.
Attached the proposed patch (sending the request_finished signal after the template is actually rendered).
Note: this can also fix #4612, though I'm not completely sure.
Attachments (2)
Change History (5)
by , 17 years ago
Attachment: | stale_connections_fix.diff added |
---|
comment:1 by , 17 years ago
Has patch: | set |
---|
by , 17 years ago
Attachment: | response-wrapping.patch added |
---|
Wrap the response object, firing the signal once the response object is fully consumed
comment:2 by , 17 years ago
Cc: | added |
---|
If folks could kindly give that a test, would be appreciated- still preserves the iteration, but basically injects the signal firing as the last step for full iteration of the object.
At least for the mod_python wsgi implementation I looked over (and digging through pep 333), this *should* do the trick. Comments/complaints/feedback desired.
comment:3 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Discussion: http://groups.google.com/group/django-users/browse_thread/thread/588718d711a5a0f0/6124af7e3aa86773