Comments (11)
Rewrote my zmq test in czmq, still not seeing the growth. Please double check my code and results.
https://gist.github.com/deepcube/5423034
from czmq.
Running under valgrind:
gcc -c -o out/obj/czmq_leak_s.o src/czmq_leak_s.c -Iinclude
gcc -o out/czmq_leak_s out/obj/czmq_leak_s.o -Iinclude -lzmq -lczmq
==11664== Memcheck, a memory error detector
==11664== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==11664== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info
==11664== Command: out/czmq_leak_s
==11664==
Starting DDOS test.
ZMQ version is 3.2.3
CZMQ version is 1.4.0
^CInterrupted, please take a moment to observe the size of the executable in memory.
Press enter when done...
Shutting down...
==11664==
==11664== HEAP SUMMARY:
==11664== in use at exit: 0 bytes in 0 blocks
==11664== total heap usage: 253,803 allocs, 253,803 frees, 411,935,709 bytes allocated
==11664==
==11664== All heap blocks were freed -- no leaks are possible
==11664==
==11664== For counts of detected and suppressed errors, rerun with: -v
==11664== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)
No leak, but my example server did grow over time. You can see it grew from its base size to 260kb to 392.85mb. (411,935,709 bytes)
from czmq.
Upon further testing, if the server does zmq_poll(3) or zmq_recvmsg(3), then there is no memory growth. If the server spins ( for(;;); ), sleep(3), or pause(3), there is growth.
from czmq.
Isn't this expected behavior? The server is queuing up the messages during the sleep() - it'll only free up that memory if it can pull the messages off the queue and do something with them.
from czmq.
Makes sense to me
from czmq.
I guess I am a bit perplexed, as in the example code (https://gist.github.com/JustonDavies/5266122) the client only connects, waits a moment, then disconnects. I never explicitly send anything and thus nothing would need to be received or removed from the queue.
from czmq.
It sound more like dangling socket handles.
On Apr 24, 2013 7:30 PM, "nga⁴" [email protected] wrote:
I guess I am a bit perplexed, as in the example code (
https://gist.github.com/JustonDavies/5266122) the client only connects,
waits a moment, then disconnects. I never explicitly send anything and thus
nothing would need to be received or removed from the queue.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/141#issuecomment-16950457
.
from czmq.
Yes, but only if you don't send messages?
from czmq.
Well I re-wrote the example using the native bindings. Server starts, clients connect and disconnect sending nothing, the server just idles never invoking a receive and I can replicate the growth. However, if I put the server in a loop where it attempts to receive (while the clients still start up connect/disconnect sending nothing) the problem never occurs. https://gist.github.com/JustonDavies/5437189
It seems that asking the server to receive (even when nothing is being sent) prevents the problem. This limits the means of attack to any time you might have a socket that people could connect to that never invokes a receive.
To state the obvious, I might have jumped the gun saying this was a czmq specific problem. I should've read the other gist before hand and logged the bug in the correct place.
from czmq.
Ah... This is in fact normal. If the main thread doesn't call libzmq
internal events will accumulate. It's not an attack vector, but an
incorrect use of the API. It May need better documentation.
On Apr 24, 2013 8:01 PM, "nga⁴" [email protected] wrote:
Well I re-wrote the example using the native bindings. Server starts,
clients connect and disconnect sending nothing, the server just idles never
invoking a receive and I can replicate the growth. However, if I put the
server in a loop where it attempts to receive (while the clients still
start up connect/disconnect sending nothing) the problem never occurs.
https://gist.github.com/JustonDavies/5437189It seems that asking the server to receive (even when nothing is being
sent) prevents the problem. This limits the means of attack to any time you
might have a socket that people could connect to that never invokes a
receive.To state the obvious, I might have jumped the gun saying this was a czmq
specific problem. I should've read the other gist before hand and logged
the bug in the correct place.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/141#issuecomment-16953470
.
from czmq.
Closing this.
from czmq.
Related Issues (20)
- Android / Java bindings/jni/ci_build.sh fails on Ubuntu 22.04 HOT 3
- zauth `zsock_bind()` fails when called for the second time from a different thread
- Lingering broken TCP connections when using zproxy
- czmq bindiing jni should be deployed to maven central jcenter is now read only. HOT 1
- Tests on OSX? HOT 1
- Ios Build Fails Please check the log on IOS sdk 16.2 HOT 2
- zsock_events() segfaults if called too often HOT 4
- How to get peer PID with czmq? HOT 1
- Saving certificate to memory?
- An error occurs when the zsock_set_tcp_keepalive function is executed HOT 2
- ziflist crashes when there are 'alias' net devices HOT 1
- zpoller_wait() will fail if WiFi networks are switched or after Windows sleep and even rebuilding all sockets doesn't make it recover HOT 9
- No MSYS2 package HOT 2
- zloop allows calling start() again but timer removal fails then HOT 2
- Issue with libczmq-dev HOT 1
- Problem: czmq `make check` tests do not display properly in terminal HOT 1
- Problem: When zauth unable to load password file it uses zsys `info` instead of `warn`
- zloop: nonstop does not work as intended (EINTR breaks loop) HOT 2
- No QNX Compile Options for s_reload in ziflist.c HOT 1
- Problem:Dose XPub-XSub proxy support Curve/Plain authentication?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from czmq.