-
Notifications
You must be signed in to change notification settings - Fork 24
Description
if wrapper used excesivly, asking many properties on many hosts, ist crashs with too many open files error.
Traceback
(most recent call last):
File "/opt/test/wmiserv/service_wmi.py", line 418, in get_df
output=(wmic.query("SELECT Name,FileSystem,Size,FreeSpace FROM Win32_Logicaldisk"))
File "/usr/lib/python2.7/site-packages/wmi_client_wrapper/wrapper.py", line 92, in query
output = sh.wmic(*arguments)
File "/usr/lib/python2.7/site-packages/sh.py", line 1028, in call
return RunningCommand(cmd, call_args, stdin, stdout, stderr)
File "/usr/lib/python2.7/site-packages/sh.py", line 490, in init
self.call_args, pipe)
File "/usr/lib/python2.7/site-packages/sh.py", line 1192, in init
self._slave_stdin_fd, self._stdin_fd = os.pipe()
OSError: [Errno 24] Too many open files
This is because there is no exception handling, no timeouts and piped input for no reason.
original:
line 92 : output = sh.wmic(*arguments)
fix seems to works for me:
try: output = sh.wmic(*arguments,_timeout=35,_tty_in=True,_new_session=False) except sh.TimeoutException: output = "timeout"