wsgi + multiprocessing

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

wsgi + multiprocessing

Ed Summers
I realize this is probably a pretty silly question, but I was
wondering if anyone can provide any insight.

I've been trying to use the multiprocessing [1] in a WSGI environment
and have observed what appears to be deadlock behavior under
mod_wsgi+django and
web.py. I created a minimal example web.py to demonstrate [2]. If you
have web.py available you should be able to run that script and then
point your browser at:

    http://localhost:8080/

and then watch your browser hang when you visit:

    http://locahost:8080/?multiprocessing=1

Going forward I'm most likely going to move this functionality to an
asynchronous queue (celery, etc) but I was wondering if
multiprocessing + WSGI was generally known to be something to avoid,
or if it was even forbidden somehow.

Any assistance you can provide would be welcome.

//Ed

[1] http://docs.python.org/library/multiprocessing.html
[2] https://gist.github.com/951570
_______________________________________________
Web-SIG mailing list
[hidden email]
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: http://mail.python.org/mailman/options/web-sig/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: wsgi + multiprocessing

Ed Summers
Actually this appears to only be a problem for Django and web.py when
they are running under mod_wsgi. I don't see the hanging behavior when
running under django runserver, or single threaded web.py ... so
perhaps this question is best asked over on the mod_wsgi discussion
list?

//Ed

On Mon, May 2, 2011 at 9:05 AM, Ed Summers <[hidden email]> wrote:

> I realize this is probably a pretty silly question, but I was
> wondering if anyone can provide any insight.
>
> I've been trying to use the multiprocessing [1] in a WSGI environment
> and have observed what appears to be deadlock behavior under
> mod_wsgi+django and
> web.py. I created a minimal example web.py to demonstrate [2]. If you
> have web.py available you should be able to run that script and then
> point your browser at:
>
>    http://localhost:8080/
>
> and then watch your browser hang when you visit:
>
>    http://locahost:8080/?multiprocessing=1
>
> Going forward I'm most likely going to move this functionality to an
> asynchronous queue (celery, etc) but I was wondering if
> multiprocessing + WSGI was generally known to be something to avoid,
> or if it was even forbidden somehow.
>
> Any assistance you can provide would be welcome.
>
> //Ed
>
> [1] http://docs.python.org/library/multiprocessing.html
> [2] https://gist.github.com/951570
>
_______________________________________________
Web-SIG mailing list
[hidden email]
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: http://mail.python.org/mailman/options/web-sig/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: wsgi + multiprocessing

Daniel Holth-3
http://www.doughellmann.com/PyMOTW/multiprocessing/basics.html#daemon-processes ?

_______________________________________________
Web-SIG mailing list
[hidden email]
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: http://mail.python.org/mailman/options/web-sig/lists%40nabble.com