From ehs at pobox.com Mon May 2 15:05:22 2011 From: ehs at pobox.com (Ed Summers) Date: Mon, 2 May 2011 09:05:22 -0400 Subject: [Web-SIG] wsgi + multiprocessing Message-ID: 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 From ehs at pobox.com Mon May 2 15:30:24 2011 From: ehs at pobox.com (Ed Summers) Date: Mon, 2 May 2011 09:30:24 -0400 Subject: [Web-SIG] wsgi + multiprocessing In-Reply-To: References: Message-ID: 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 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 > From dholth at gmail.com Mon May 2 19:01:11 2011 From: dholth at gmail.com (Daniel Holth) Date: Mon, 2 May 2011 10:01:11 -0700 (PDT) Subject: [Web-SIG] wsgi + multiprocessing In-Reply-To: Message-ID: <25022616.736.1304355671481.JavaMail.geo-discussion-forums@yqkv17> http://www.doughellmann.com/PyMOTW/multiprocessing/basics.html#daemon-processes ? -------------- next part -------------- An HTML attachment was scrubbed... URL: