I tried this with uwsgi-0.9.8.1, and it works in single process mode, but not in multi process mode (when using either --master, or --touch-reload)
Vitaliy On Mon, Jun 20, 2011 at 6:32 PM, Roberto De Ioris <[email protected]> wrote: > > > I have a python application that uses a queue in a thread, but it doesn't > > appear to work when run under uwsgi. I'm using uwsgi-0.9.8 + python 2.6 > + > > nginx 1.0.4. > > > > Test script: > > > > test.py: > > <<>> > > import threading, time, Queue > > > > q = Queue.Queue() > > def logger(): > > open("/tmp/out.txt", "w").write("starting\n") > > while True: > > item = q.get() > > open("/tmp/out.txt", "a").write(item + "\n"); > > q.task_done() > > > > t = threading.Thread(target=logger) > > t.setDaemon(True) > > t.start() > > > > def application(environ, start_response): > > status = '200 OK' > > output = 'Hello World' > > response_headers = [('Content-type', 'text/plain'), > > ('Content-Length', str(len(output)))] > > start_response(status, response_headers) > > q.put(str(time.time())) > > return [output] > > <<>> > > > > I start the uwsgi server with: > > uwsgi --socket test.sock --daemonize test.log --enable-threads test.py > > > > In this example, the thread gets started, but q.get() just blocks > > indefinitely even though items are being put into the queue. > > > > The same example works correctly under apache + mod_wsgi. > > > > How can I get this to work with uwsgi? > > > > Vitaliy > > > Hi, sorry but the internet connection at europython is very flaky so i am > not able to check for this error. Can you fill a bug report ? I will check > it asap (i hope tomorrow) > > > -- > Roberto De Ioris > http://unbit.it > _______________________________________________ > uWSGI mailing list > [email protected] > http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi >
_______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
