Opened 17 years ago

Closed 17 years ago

#4909 closed (fixed)

WSGIHandler is not threadsafe

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

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

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

Download all attachments as: .zip

Change History (3)

by colin@…, 17 years ago

Attachment: wsgi-thread-safe-init.patch added

comment:1 by Simon G. <dev@…>, 17 years ago

Has patch: set
Triage Stage: UnreviewedReady for checkin

comment:2 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: newclosed

(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