[pysnmp-users] pysnmp leaks temporary resources running script with root privileges under Ubuntu 14
Brought to you by:
elie
From: Markus B. <mb...@ma...> - 2016-05-03 12:35:16
|
Hello, i found out that running a pysnmp script as root with a self assigned SnmpEngineId leads to a resource leak (missing close) of temporary files generated by pysnmp. The attached testscript demonstrates the Problem. if i start the script with 'sudo ./pysnmp_fd.py' and investigate the list of open files with 'sudo lsof -p <pidofscript>' i get this for example: ... python3 26101 root 5u IPv4 973309 0t0 UDP *:39370 python3 26101 root 6u REG 8,33 0 4068419 /tmp/__pysnmp/0x8000000001020304/tmpl5h37q3f python3 26101 root 7u REG 8,33 0 4068420 /tmp/__pysnmp/0x8000000001020304/tmpcenfh0fm python3 26101 root 8u REG 8,33 0 4068423 /tmp/__pysnmp/0x8000000001020304/tmpwojwxt30 python3 26101 root 9u REG 8,33 0 4068421 /tmp/__pysnmp/0x8000000001020304/tmpkfs4hu1f python3 26101 root 10u REG 8,33 0 4068426 /tmp/__pysnmp/0x8000000001020304/tmptxdjiven python3 26101 root 11u REG 8,33 0 4068422 /tmp/__pysnmp/0x8000000001020304/tmpnch_emnz python3 26101 root 12u REG 8,33 0 4068424 /tmp/__pysnmp/0x8000000001020304/tmpf0lxqusd python3 26101 root 13u IPv4 973311 0t0 UDP *:36011 python3 26101 root 14u REG 8,33 0 4068425 /tmp/__pysnmp/0x8000000001020304/tmphtq5h3bb python3 26101 root 15u REG 8,33 0 4068427 /tmp/__pysnmp/0x8000000001020304/tmpt1d5xmmy python3 26101 root 16u IPv4 973320 0t0 UDP *:36018 ... The List of files will grow until the max number of filedescriptors is reached (throwing an exception). If I remove the self assigned EngineId from SNMPEngine()'s Ctor no temporary files are created. Am I doing something wrong?? System: Ubuntu 14.04 x86_64 pysnmp: Version: 4.3.2 python: Python 3.4.3 Best Regards Markus Bienst |