Opened 9 years ago

Closed 9 years ago

#4909 closed (fixed)

WSGIHandler is not threadsafe

Reported by: colin@… Owned by: jacob
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


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:


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 (1)

wsgi-thread-safe-init.patch (1.1 KB) - added by colin@… 9 years ago.

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by colin@…

comment:1 Changed 9 years ago by Simon G. <dev@…>

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 9 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

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

Note: See TracTickets for help on using tickets.
Back to Top