Finally, I found I identified the problem but I don't know why.

According to ZMQ specification, the ZMQ context should be shared to create
all the ZMQ sockets of the same process. What we did, is to create a Python
module which creates such ZMQ context:

# zmq_context.py
import zmq
context = zmq.Context()

If you create the following WSGI app:

import zmq
import zmq_context
def application(environ, start_response):
    context = zmq_context.context
    socket_push = context.socket(zmq.PUSH)
    socket_push.connect('tcp://localhost:9876')
    socket_push.send_multipart(["Hello", "World"])

Then uWSGi dies when zmq tries to connect to the ZQM socket.

However, if we don't use the zmq_context module and create the context
directly:

import zmq
def application(environ, start_response):
    context = zmq.Context()
    socket_push = context.socket(zmq.PUSH)
    socket_push.connect('tcp://localhost:9876')
    socket_push.send_multipart(["Hello", "World"])

Everything works.

Why? I cannot see any difference. And, as I said, it works with wsgiref (I
haven't tested with other WSGi servers)

Thanks in advance,
Jaime
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to