>No offence taken, sorry if I seemed rude. What I meant to say was, it's
>user-built software, so if you have suggestions for >improvements, the right
>way to make them is via patches.
Excellent and agreed.
In the meantime I found the problem by debugging into the ZMQ sources. I'll
describe the problem here, and a workaround just to make sure that this threads
ends with a solution.
1. The problem:
- when closing the context, the tcp_listeners go into
tcp_listener_t::process_term
- which calls a tcp_listener_t::close
- which sends a socket->event_closed (endpoint, s);
- which calls socket_base_t::monitor_event
- which executes if (monitor_socket)
In the meantime, someone (the reaper?) sends STOP for the monitor
sockets
- which calls socket_base_t::process_stop
- which calls socket_base_t::stop_monitor()
- which closes the monitor_socket
- end sets monitor_socket = NULL
I can see that monitor_socket is != NULL when I enter
socket_base_t::monitor_event, but NULL when it crashes. I.e. we have a race
condition between _ctx_term sending and event_closed and the shutting down of
the monitor socket.
2. Workaround:
There is an undocumented feature in socket_base_t::monitor:
// Support deregistering monitoring endpoints as well
if (addr_ == NULL) {
stop_monitor ();
return 0;
}
So I call
rc = zmq_socket_monitor(m_pZReceiveSocket, NULL, ZMQ_EVENT_ALL);
- which calls socket_base_t::monitor
- which calls stop_monitor ();
- which closes the monitor and sets monitor_socket = NULL
- So later (few ms really) when ctx_term comes to work:
- monitor_socket == NULL and _base_t::monitor_event does no try to send
an event with the dying monitor
3. Solution
zmq_disconnect should also call stop_monitor. I'll try to make a patch, but
it'll take some time.
Best regards
Björn
Dr. Björn Kuhlbrodt
Senior Software Developer
GP Inspect GmbH
Tel: +49 89 750778 4729
Fax: +49 89 750778 4710
Mail: [email protected]
GP Inspect GmbH | Hainbuchenring 9-11 | 82061 Neuried | Deutschland
Geschäftsführer | Christian Probst, Dr. Eric Rüland, Enis Ersü, Martin Heinrich
Amtsgericht München | HRB 173887
A company of ISRA VISION Group
------------------------------------------------------------------------------------------------------
This e-mail may contain material that is confidential, privileged and for the
sole use of the intended recipient. Any review, reliance or
distribution by others or forwarding without express permission is strictly
prohibited. If you are not the intended recipient, please
contact the sender and delete all copies. GP Inspect GmbH, ISRA VISION AG, its
branches and subsidiaries herewith exclude
any liability for third-party information recognizably contained in this email
or its attachments. Third-party information does not
necessarily reflect the opinion of GP Inspect GmbH or ISRA VISION AG.
------------------------------------------------------------------------------------------------------
WWW.GPSOLAR.COM
WWW.ISRAVISION.COM
------------------------------------------------------------------------------------------------------
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Pieter Hintjens
Sent: Mittwoch, 22. Januar 2014 20:40
To: ZeroMQ development list
Subject: Re: [zeromq-dev] zmq_socket_monitor blocks port of REP/REQ TCP/IP in C
On Wed, Jan 22, 2014 at 4:00 AM, Björn Kuhlbrodt <[email protected]>
wrote:
> No offence meant. I appreciate your work and being a developer myself can
> full-heartedly understand that 'Hey that free stuff isn't working'-mails are
> not welcome.
No offence taken, sorry if I seemed rude. What I meant to say was, it's
user-built software, so if you have suggestions for improvements, the right way
to make them is via patches.
-Pieter
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev