tango-controls / cppTango

Moved to gitlab
http://tango-controls.org
41 stars 34 forks source link

Memory leak in C++ DevServer command exceptions? #100

Closed tango-controls-bot closed 8 years ago

tango-controls-bot commented 14 years ago

Hi all,

After putting all (75) our Modbus device servers in a single machine we detected that the memory usage was continuously increasing due to Modbus devices.

After some investigation we detected that the cause were those Modbus device servers who were unable to connect with its IpHost and were throwing timeout exceptions for any command executed.

The problem seems related to the C++ command exception itself, as no increase in memory usage has been observed in other modbus devices. It's easy to reproduce executing a faulty asynchronous command at a regular basis.

Sergi Rubio Manrique
Electronics & Controls Engineer
CELLS - ALBA Synchrotron - Computing Division Carretera BP 1413, de Cerdanyola del Vallès a Sant Cugat del Vallès 08290 Cerdanyola del Vallès (Barcelona) Phone: +34 93 592 43 87
http://www.cells.es/Members/srubio / sergi.rubio@cells.es

Reported by: sergirubio

Original Ticket: tango-cs/bugs/320

tango-controls-bot commented 14 years ago

Hola Sergi,

I did some tests this morning and effectively there is one case where it seems there is a memory leak. This case is the following: A device command takes more than 3 seconds (default timeout). I Think this is what happens in your case for Modbus device not able to communicate with their "IpHost". After the timeout exception, the client re-send the command. As command 1 is still in execution (timeout is a local exception on the client side), the server now has 2 commands (the old one still in its execution) and the new one (waiting for device monitor). From Valgrind, the leak comes from the omniORB layer. I will check this with Duncan and let you know what happens.

Cheers

Manu

Original comment by: taurel

tango-controls-bot commented 14 years ago

omniORB patch

Original comment by: taurel

tango-controls-bot commented 14 years ago

Hola Sergi,

Pftttttt. Not an easy bug, Anyway, Duncan (from omniORB) provides a patch to fix this memory leak. I have applied it and re-done my test. Valgrind is now quiet. Great no? I have uploaded the patch file with this bug report. You have to apply it on the omniORB source directory tree and re-compile omniORB

Good luck

Manu

Original comment by: taurel

tango-controls-bot commented 14 years ago

Original comment by: taurel

tango-controls-bot commented 14 years ago

Hola todos,

The patch file "giop_leak" fixes the memory leak but breaks something else in omniORB. There is another patch file. To get a full fix, apply the two patches or die..

Just to remind you the case where this memory leak happens: Using Tango 7.1 with client and server processes on the same host with time consuming commands/attributes generating timeouts on the client side.

Cheers

Manu

Original comment by: taurel

tango-controls-bot commented 14 years ago

Original comment by: taurel