rtyler / Spawning

Spawning is a wsgi server which supports multiple processes, multiple threads, green threads, non-blocking HTTP io, and automatic graceful upgrading of code
http://pypi.python.org/pypi/Spawning
MIT License
119 stars 18 forks source link

--threads=x for x>1 results in no response bodies ever being served #25

Open durin42 opened 14 years ago

durin42 commented 14 years ago

Reproduction recipe: WSGI application:

"""Support for running hgweb as a WSGI app inside spawning."""
import os
HERE = os.path.dirname(__file__)
from mercurial.hgweb.hgwebdir_mod import hgwebdir
application = hgwebdir(os.path.join(HERE, 'hgweb.config'))

hgweb.config, which should be in the same dir as the wsgi application:

[extensions]
highlight=

[paths]
/ = /Some/path/with/several/hg/repositories/*

Run spawning, with actual output after attempting to load one page:

[imladris:~/Programming/spawnhg] augie% spawning spawnhg.application --reload=dev --port 9000 -i 0.0.0.0 --pidfile=spawning.pid --processes 2 --threads 4
(57697) *** Controller starting at Sun Oct 17 18:01:06 2010
Should start 2 new children
Controller.spawn_children(number=2)
(57698) reloader watching sys.modules
(57699) reloader watching sys.modules
(57698) wsgi starting up on http://0.0.0.0:9000/
(57699) wsgi starting up on http://0.0.0.0:9000/
127.0.0.1 - - [17/Oct/2010 18:01:09] "GET /?sort=lastchange HTTP/1.1" 200 162 0.376568

But the response from the server never arrives. Checking with cURL indicates that the response headers are served but the body never arrives:

[imladris:~] augie% curl -v http://localhost:9000/
* About to connect() to localhost port 9000 (#0)
*   Trying ::1... Connection refused
*   Trying fe80::1... Connection refused
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 9000 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
> Host: localhost:9000
> Accept: */*
> 
< HTTP/1.1 200 Script output follows
< Content-Type: text/html; charset=UTF-8
< Content-Length: 25353
< Date: Sun, 17 Oct 2010 23:02:41 GMT
< 
rtyler commented 14 years ago

I'm wondering if this has anything to do with wsgi app support, my use of Spawning with threads is when using the django_factory.

Will investigate when I get some time (hopefully this evening)

durin42 commented 14 years ago

It occurs to me that this might be related (somehow) to a generator response that isn't getting iterated properly.