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
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to