[zeromq-dev] fd leak with dealer to dealer with tcp as transport
Bill Torpey
wallstprog at gmail.com
Fri Jan 3 17:46:18 CET 2020
Hi Siva:
Bear in mind that zmq_disconnect is asynchronous (not well-documented IMO, but e.g., see https://github.com/zeromq/libzmq/issues/2759#issuecomment-389057453 <https://github.com/zeromq/libzmq/issues/2759#issuecomment-389057453>). zmq_connect is also asynchronous in most cases (except inproc). It also takes some time for fd’s to be reclaimed by OS.
- Do fd’s eventually get reclaimed when system is idle?
- What state are fd’s in while application is running (e.g., lsof -p <PID> | grep TCP)?
- Have you tried using zmq_socket_monitor to trace what is happening under the covers?
FWIW, you may want to reconsider the connect/send/disconnect approach - the overhead of connect/disconnect is considerable. If you can connect once to each destination, life will be much simpler.
Good luck!
Bill
> On Nov 14, 2019, at 7:29 AM, donthamsetty sivaprasad via zeromq-dev <zeromq-dev at lists.zeromq.org> wrote:
>
> Hi ,
> thanks for the response.
> I have multiple tasks(threads).
> Each task has tx and rx ZMQ DEALER sockets with bind to tcp addresses.
> Each guy before sending a packet to other one does zmq_connect , zmq_msg_send and zmq_disconnect. The reason for doing zmq_disconnect is sender's next packet could be to a different receiver other than the first one.
>
> Now the first question is does zmq_disconnect destroys tcp sockets underneath or not ..( for that sender/receiver combo)??
>
> When I did lsof it shows very huge number something like 50K..
>
> Thanks
> Siva
>
>
>
> On Thursday, November 14, 2019, 04:57:22 PM GMT+5:30, Arnaud Loonstra <arnaud at sphaero.org> wrote:
>
>
> On 14-11-2019 10:07, donthamsetty sivaprasad via zeromq-dev wrote:
> > Hi ,
> > I have DEALER sockets with tcp as transport.
> > Before sending each packet I do zmq_connect , zmq_msg_send and
> > zmq_disconnect since same DEALER can talk to another dealer ( it is many
> > to many communication ,but no load bancing or round robin)..
> >
> > The system is crashing running out of file descriptors in the system..
> > Could you please help me..?
> >
> > Thanks
> > Siva
> >
>
> Please show some code which demonstrates your problem. It sounds like
> you are constantly creating new sockets without destroying them. In
> general you first connect and then send the message. You only disconnect
> if you need to (usually on destroy). Also have you read the zeromq
> guide? It shows many examples.
>
> Rg,
>
> Arnaud
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org <mailto:zeromq-dev at lists.zeromq.org>
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev <https://lists.zeromq.org/mailman/listinfo/zeromq-dev>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20200103/377ee76d/attachment.htm>
More information about the zeromq-dev
mailing list