[zeromq-dev] Fwd: it seems there are significant memory leak in libzmq
Yunkai Zhang
yunkai.me at gmail.com
Fri Apr 4 09:34:48 CEST 2014
Hi folks:
We plan to use salt in our production environment, and we need to keep
heartbeat to salt server by periodical short connection.
But unfortunately, we found that heartbeat connection will cause salt
server memory leak significantly.
With some more deep testing, we found the root cause might be *pyzmq* or
*libzmq*. And we have seeked help at pyzmq's comunitity, they told us that
it should be libzmq's bug.
I'm a newbie for libzmq, I use systemtap to analyze the execution times of
malloc()/free() issued by libzmq across a heartbeat connection, the result
shows that the calls of malloc()/free() are unparied. Obviously, there are
memory leak in libzmq or the upper caller(pyzmq) does not call the API of
libzmq correctly.
I'll show my test script here, hope someone can help us to fix the bug:
1) Compiles the latest version of libzmq and install it to /usr/local/
directory.
2) Build the latest version of pyzmq, and copy the
"pyzmq/build/lib.linux-x86_64-2.7/zmq" to "salt/packages/" directory.
3) Start salt server: ./salt-master
4) Use *run.sh.ext*(see attatchment, it will use *malloc-free-libzmq.stp*
script internally) to monitor the exectution of malloc()/free() in libzmq.
5) Use *client-request.py*(see attachment) to simulate a heartbeat request
to salt server.
The *systemtap-libzmq-output.log* file was the output of *run.sh.ext*, it
shows that the calls of malloc()/free() are unpaired.
NOTE: run.sh would be reject by the mailing list, so I rename it to
run.sh.ext.
--
Yunkai Zhang
Work at Taobao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140404/47413169/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: malloc-free-libzmq.stp
Type: application/octet-stream
Size: 489 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140404/47413169/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: systemtap-libzmq-output.log
Type: text/x-log
Size: 12767 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140404/47413169/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: client-request.py
Type: text/x-python
Size: 1326 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140404/47413169/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: run.sh.ext
Type: application/octet-stream
Size: 336 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140404/47413169/attachment-0001.obj>
More information about the zeromq-dev
mailing list