From 87700d6d3de63a398bb362141aa01119ce28d188 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 12 Jun 2014 14:42:09 -0400 Subject: [PATCH] Fix filehandles leaking on shell modules When shell module plugins failed and exited, confluent was failing to release the filehandle. This would ultimately lead to unreasonable exhaustion of filehandles. --- TODO | 33 +++++++++++++++++++++++ confluent_server/confluent/shellmodule.py | 1 + 2 files changed, 34 insertions(+) diff --git a/TODO b/TODO index 75ec704f..3f2b6667 100644 --- a/TODO +++ b/TODO @@ -36,3 +36,36 @@ KeyError: '' while the problem cannot be reproduced without that problem fixed, the problem should only cause poor performance, not induce transpose of data... -test out bg_sync in cfg to make sure if it runs just before a change it doesn't cause loss +-set boot/nextdevice=cd after exiting console did: +/nodes/n3/ -> set boot/nextdevice=cd +Traceback (most recent call last): + File "/usr/bin/confetty", line 561, in + do_command(currcommand, netserver) + File "/usr/bin/confetty", line 300, in do_command + setvalues(argv[1:]) + File "/usr/bin/confetty", line 369, in setvalues + print_result(res) + File "/usr/bin/confetty", line 211, in print_result + for key in res.iterkeys(): +AttributeError: 'str' object has no attribute 'iterkeys' +[root@odin ~]# confetty +/ -> cd /nodes/n3 +-Jun 11 14:51:49 Traceback (most recent call last): + File "/usr/lib/python2.6/site-packages/confluent/httpapi.py", line 238, in resourcehandler + for rsp in resourcehandler_backend(env, start_response): + File "/usr/lib/python2.6/site-packages/confluent/httpapi.py", line 358, in resourcehandler_backend + extension): + File "/usr/lib/python2.6/site-packages/confluent/httpapi.py", line 406, in _assemble_html + for rsp in responses: + File "/usr/lib/python2.6/site-packages/confluent/core.py", line 168, in stripnode + for i in iterablersp: + File "/usr/lib/python2.6/site-packages/confluent/plugins/hardwaremanagement/ipmi.py", line 196, in next + retdata = self.currdata.next() + File "/usr/lib/python2.6/site-packages/confluent/plugins/hardwaremanagement/ipmi.py", line 288, in health + response = self.ipmicmd.get_health() + File "/usr/lib/python2.6/site-packages/pyghmi/ipmi/command.py", line 301, in get_health + for reading in self.get_sensor_data(): + File "/usr/lib/python2.6/site-packages/pyghmi/ipmi/command.py", line 322, in get_sensor_data + raise Exception(rsp['error']) +Exception: Payload already active on another session +-try to get 'health' without trailing / diff --git a/confluent_server/confluent/shellmodule.py b/confluent_server/confluent/shellmodule.py index d4f454c4..b52528ac 100644 --- a/confluent_server/confluent/shellmodule.py +++ b/confluent_server/confluent/shellmodule.py @@ -92,6 +92,7 @@ class ExecConsole(conapi.Console): os.write(self._master, data) def close(self): + os.close(self._master) if self.subproc is None or self.subproc.poll() is not None: return self.subproc.terminate()