Solved Memory leak
-
Hi,
Im developing an application that uses QTCPSockets to communicate with another PC on the same LAN, it works correctly (memory usage 13Mo stable)
My probleme will apear only if i plug the 2 PCs directly with ethernet cable, my application will work but the memory consumption keeps growing in this case
What can cause this please ?
-
Can you try if you can reproduce the same behaviour using this program? Trying to understand if the problem is with the code or if it goes deeper
-
@VRonin thank you very much!
the Qt Simple Chat Example works nicely ... LAN and Direct, that means 'my' code is in cause.My app is based on this VNC/rfb implementation made with Qt https://bitbucket.org/amahta/qvncclient/src
I will dig this tomorrow... -
@LeLev I once had QTcpSocket memory problems in a DLL without Qt event loop.
Don't know if that apllies to your case...
-
@aha_1980 thank you for the clue, I have simple widget app with event loop in the main.
-
The thing to keep in mind about TCP connections is that they don't immediately free resources when the connection is closed, or worse, folks will simply terminate the connection without cleaning up the session. In these cases you may see resources reserved until the connection overruns the default TCP timeout value. When this is noticeable is when a machine spawns many short lived sessions with other machines.
Are you explicitly closing the connections or are you simply letting the object destructor do it for you behind the scenes?
-
hi @Kent-Dorfman, the qvncclient uses only one QTCPSocket, and the session needs to be closed only when i exit the application.
Is there a reason that the behavior is not the same with LAN or Direct cable connexions ?
THXedit:
when i unplug the pc where the vnc server is (ultraVnc) from the LAN and plug it to the client (my app) PC directly, the server pc gets automatic ip adress, So i put my PC (client) to static adress on the same network to be able to connect.Is it possible i have to much information comming from the server to my client with direct cable ?
Even Wireshark (running client side) hangs periodically .. -
@LeLev said in Memory leak:
Even Wireshark (running client side) hangs periodically ..
That sounds very odd! Millions(!?) of people use Wireshark, I would think we'd know about that. I'm sure it will not have problems keeping up with ethernet cable speed. You might Google for that to make sure.
-
@JonB hi,
The problem comes from the lib qvncclient i use and maybe the protocol (rfb) itself no ? because the program @VRonin gave me worked perfectly...
I did lot of Google this 2 days for this, but im afraid there is no topics really relatedI'm very much curious about why this is happening with direct cable and not when there are Servers/switches between.. Can it be possible that servers are queuing data, but in case of direct ethernet cable i'm reciving too much ?
I use the direct cable solution because my client app needs to auto-connect to the server, so i need to know the server IP adress.
I will try to look for another solution to find the ip adress of the server i think...
Does someone have a suggestion for this ?There are maybe 150 PCs on the network, how to find the only one that has my VNC server running on ?
Thank you
-
@LeLev said in Memory leak:
There are maybe 150 PCs on the network, how to find the only one that has my VNC server running on ?
If it's on LAN just have the client broadcast a UDP message to the entire network and have the server detect it and respond by communicating its IP
-
@VRonin yes i did that already,
but the server is a 3rd party app, i can not write code in it.So i did a little Qt program that :
-
starts with the server
-
wait the message "Yourip"
-
gives its ip and closes.
i wonder if there is better solution (witout additional app)
edit :
The server will always run on the same pc. I will try to use the PCs (server) name to get its ip via DNS directlyThank you
-
-
If I had to venture a guess...you are effectively ending up with a routing loop so that connections and traffic are showing up multiple times at the NIC when you do the point-to-point configuration. To diagnose this sort of issue requires a good understanding of IP routing. and you don't mention the OS. I trust the TCP stack in Linux far more than I do the one in Windoze.
-
Output of these commands while your app is running in point-to-point?
ifconfig -a
netstat -rn
netstat -an
wait for memory usage to increase and then another
netstat -anexit program, wait 30 seconds, and do another netstat -an again
You're looking for possible routing loops, IP conflicts, or queued connections.
Also make sure to test your program using the expected IP number, not the DNS name.
-
@Kent-Dorfman hi
It looks like the problem is solved... I tried to reproduce the same thing to test the commands you send me, but the application works correctly without memory leak
The only thing i'm not sure i did last week, is setting clients PC ip address 'static', with this done, everything seems to work as expected
Thank you all for help