File descriptors leak
Hi,
DeviceProxy objects leave open file descriptors, even if the object is destroyed.
Here is a small snippet to get evidence of the problem (needs psutil Pyhon module):
import tango
import psutil
current_process = psutil.Process()
prev_fds = current_process.num_fds()
print("Connecting to a device server")
dev_proxy = tango.DeviceProxy("id00/simulator/simulator1")
print(" xxx destroying device proxy xxx")
del dev_proxy
print(f"{current_process.num_fds()-prev_fds} file descriptors left open.")
print("Connecting to another device server")
dev_proxy = tango.DeviceProxy("id00/simulator/simulator2")
print(" xxx destroying device proxy xxx")
del dev_proxy
print(f"{current_process.num_fds()-prev_fds} file descriptors left open.")
print("Reconnecting to the same first device server")
dev_proxy = tango.DeviceProxy("id00/simulator/simulator1")
print(" xxx destroying device proxy xxx")
del dev_proxy
print(f"Still {current_process.num_fds()-prev_fds} file descriptors left open.")
input("Restart the first server, and press Enter to continue")
dev_proxy = tango.DeviceProxy("id00/simulator/simulator1")
print(" xxx destroying device proxy xxx")
del dev_proxy
print(f"{current_process.num_fds()-prev_fds} file descriptors left open.")
It shows 1 file descriptor leaks in all cases, then there is an additional file descriptor left open per DeviceProxy object. Reconnecting to a previous device server does not increase the number of opened file descriptors. However, if the server is restarted a new DeviceProxy will take a new file descriptor.
This is really problematic for automatic test pipelines, for example : if there are 1000+ tests, and tests often start/stop device servers, the system reaches the file descriptors limit at some point...