[zeromq-dev] PUSH does not seem to release PULL connection message memory
Stefan de Konink
stefan at konink.de
Sat Apr 25 18:55:51 CEST 2015
This bug, and its pub/sub counterpart as described at
<https://github.com/zeromq/libzmq/issues/1256> is driving me nuts.
Consider as client:
#include <czmq.h>
int main (void)
{
int busy = 10000;
while (busy--) {
zsock_t *sub = zsock_new_sub ("tcp://127.0.0.1:1234", "");
zclock_sleep (10);
zsock_destroy (&sub);
}
return 0;
}
Consider as server:
#include <czmq.h>
int main (void) {
zsock_t *pubsub = zsock_new_pub ("tcp://127.0.0.1:1234");
int busy = 10;
while (busy--) {
zclock_sleep (2000);
zsocket_events (zsock_resolve (pubsub));
}
/* zsock_destroy (&pubsub); disabled otherwise valgrind will not show
anything*/
return 0;
}
It seems ZeroMQ is losing in-library messages. Sending a few subscribers,
then doing a zsocket_events will actually work as expected. 4 subscribers,
will result in 8 pipes being deleted. The problem arrises when the
challenge is bigger, for example 64 subscribers. Those will not return in
128 deletes, but in only 120 deletes.
Comment
<https://github.com/zeromq/libzmq/issues/1256#issuecomment-64212673>
already suggests that "so it has one sub pipe waiting on the delimiter and
the other waiting on the term ack" this seems to be the case when it goes
wrong. But by default, it doesn't go wrong, only on higher levels of
concurrency it will.
Stefan
More information about the zeromq-dev
mailing list