Django

Code

Ticket #4650 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

Since [5482], mod_python keeps a stale database connection for each HTTP request

Reported by: Ilya Semenov <semenov@inetss.com> Assigned to: adrian
Milestone: Component: Core framework
Version: SVN Keywords:
Cc: ferringb@gmail.com Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

stale_connections_fix.diff (1.6 kB) - added by Ilya Semenov <semenov@inetss.com> on 06/21/07 09:31:11.
response-wrapping.patch (1.7 kB) - added by Brian Harring <ferringb@gmail.com> on 06/21/07 20:36:15.
Wrap the response object, firing the signal once the response object is fully consumed

Change History

06/21/07 09:31:11 changed by Ilya Semenov <semenov@inetss.com>

  • attachment stale_connections_fix.diff added.

06/21/07 09:33:29 changed by Ilya Semenov <semenov@inetss.com>

  • needs_better_patch changed.
  • has_patch set to 1.
  • needs_tests changed.
  • needs_docs changed.

06/21/07 20:36:15 changed by Brian Harring <ferringb@gmail.com>

  • attachment response-wrapping.patch added.

Wrap the response object, firing the signal once the response object is fully consumed

06/21/07 20:38:15 changed by Brian Harring <ferringb@gmail.com>

  • cc set to ferringb@gmail.com.

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.

07/14/07 04:46:09 changed by Simon G. <dev@simon.net.nz>

  • status changed from new to closed.
  • resolution set to fixed.

[5482] was backed out in [5511]


Add/Change #4650 (Since [5482], mod_python keeps a stale database connection for each HTTP request)




Change Properties
Action