[uWSGI] Incompatibility between PyZMQ and uWSGI

Jaime Fernández jjjaime at gmail.com
Thu Nov 25 18:20:58 CET 2010


Thanks. I've modified the sample to:

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

and now it works. Probably this is an awful solution because a new context
is generated for every request (although I'm not sure)

Would you mind to provide a link to the patch? I couldn't find it. Do you
recommend us to take the latest version of your repository?

I will think about this issue to make my project work in uWSGI.

Thanks for your support,
Jaime



>
> If you put the initialization out of the application callable, multiple
> worker processes will use the same socket as
> the fork() is called after module loading.
>
> If you use a single uWSGI worker (without master) it should work normally.
>
> The right approach is applying the post_fork_hook patch (you will find it
> in the list archive, or you can use the current mercurial tip
> that already includes it) and define a function to be called after every
> fork (so you will put context initialization in it)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.unbit.it/pipermail/uwsgi/attachments/20101125/44abf9e6/attachment.htm 


More information about the uWSGI mailing list