[Web-SIG] WSGI 2.0

Phillip J. Eby pje at telecommunity.com
Thu Oct 4 18:56:12 CEST 2007


At 06:37 PM 10/4/2007 +0200, Manlio Perillo wrote:
>To make an example (not tested), suppose that a WSGI application keeps a
>global counter (as a thread specific data).
>
>When a new request arrives, the counter is reset to 0, and its value is
>incremented for every iteration.
>
>With all the existing WSGI implementation (as far as I know), we always
>know the current value of the counter: it will start at 0, reach the
>number of iterations, and then will start at 0 again.

So?  An application that does this is obviously broken.  Again, 
remember that the WSGI spec encourages interleaving, so any 
multi-threaded server is well within its  rights to do the same thing.

There is nothing in WSGI that says multiple simultaneous requests 
cannot be run in the same thread.  Therefore, nothing is guaranteed 
about what happens to global or thread-local resources while the 
application (or its returned iterable) is not actually executing.



More information about the Web-SIG mailing list