[zeromq-dev] python-zeromq can't work with fork?
Martin Sustrik
sustrik at fastmq.com
Tue May 19 10:00:21 CEST 2009
> 272 setCloseOnExec(parent)
> 273 child.setblocking(0)
> 274 setCloseOnExec(child)
> 275 try:
> 276 pid = os.fork()
> 277 except OSError, e:
> 278 if e[0] in (errno.EAGAIN, errno.ENOMEM):
> 279 return False # Can't fork anymore.
> 280 raise
> 281 if not pid:
> 282 # Child
> 283 child.close()
> 284 # Put child into its own process group.
> 285 pid = os.getpid()
>
> ...
>
>
> my problem is
>
> when my web app work together with the fork method
>
> then send the message
>
> the zmq_server seem can't receive the message
>
> when use the single process method
>
> everything is right
I'm still not completely sure what you are doing. Are you trying to use
queue/exchange declared in one thread/process from another
thread/process? If so, it won't work. Queues/exchanges can be used only
from the thread that created them. Other thread/processes can do nothing
but bind to them.
Does this explain what you are seeing?
Martin
More information about the zeromq-dev
mailing list