Django

Code

Ticket #4909 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

WSGIHandler is not threadsafe

Reported by: colin@owlfish.com Assigned to: jacob
Milestone: Component: Uncategorized
Version: SVN Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

The call method of WSGIHandler is called from multiple threads, however there code that checks for the middleware being setup is not thread safe.

{{{if self._request_middleware is None:

self.load_middleware()}}}

Multiple threads can launch into load_middleware at once, leading to corrupt lists.

The attached patch uses a lock to protect the middleware loading if it's required.

Attachments

wsgi-thread-safe-init.patch (1.1 kB) - added by colin@owlfish.com on 07/17/07 14:11:38.

Change History

07/17/07 14:11:38 changed by colin@owlfish.com

  • attachment wsgi-thread-safe-init.patch added.

07/30/07 06:53:36 changed by Simon G. <dev@simon.net.nz>

  • needs_better_patch changed.
  • has_patch set to 1.
  • stage changed from Unreviewed to Ready for checkin.
  • needs_tests changed.
  • needs_docs changed.

08/12/07 05:24:06 changed by mtredinnick

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

(In [5868]) Fixed #4909 -- Fixed a race condition with middleware initialisation in multi-threaded setups. Thanks, colin@owlfish.com.


Add/Change #4909 (WSGIHandler is not threadsafe)




Change Properties
Action