mirror of https://github.com/fail2ban/fail2ban
BF(?): stop/join notifier only if defined
Somehow on that elderly squeeze Debian sparc box, I got error that self.__notifier was not defined. So first I did define it now in the constructor, but mystery remains how come it was not defined -- wasn"t run() then run (where it is defined)? Anyways -- conditioning on it being defined might be safer may be? Not sure (need to go to sleep) if with this change but on this box I also run from time to time either into stalling of fail2ban-testcases and refusing to exit normally or ====================================================================== ERROR: test_move_into_file_after_removed (testcases.filtertestcase.MonitorFailures<FilterPyinotify>(/tmp/monitorfailures_FilterPyinotifypcHmMJfail2ban)) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/yoh/deb/gits/fail2ban/testcases/filtertestcase.py", line 473, in tearDown self.filter.stop() File "/home/yoh/deb/gits/fail2ban/server/filterpyinotify.py", line 196, in stop self.__notifier.stop() File "/usr/lib/pymodules/python2.6/pyinotify.py", line 1315, in stop threading.Thread.join(self) File "/usr/lib/python2.6/threading.py", line 633, in join raise RuntimeError("cannot join thread before it is started") RuntimeError: cannot join thread before it is started that is with pyinotify 0.8.9-1 so could quite be "related" to its age.pull/694/head
parent
cb9cbd754e
commit
e19f9e1697
|
@ -69,6 +69,7 @@ class FilterPyinotify(FileFilter):
|
|||
# Pyinotify watch manager
|
||||
self.__monitor = pyinotify.WatchManager()
|
||||
self.__watches = dict()
|
||||
self.__notifier = None
|
||||
logSys.debug("Created FilterPyinotify")
|
||||
|
||||
|
||||
|
@ -190,9 +191,10 @@ class FilterPyinotify(FileFilter):
|
|||
def stop(self):
|
||||
super(FilterPyinotify, self).stop()
|
||||
|
||||
# Stop the notifier thread
|
||||
self.__notifier.stop()
|
||||
self.__notifier.join() # to not exit before notifier does
|
||||
# Stop the notifier thread if it was ran and notifier was created
|
||||
if self.__notifier is not None:
|
||||
self.__notifier.stop()
|
||||
self.__notifier.join() # to not exit before notifier does
|
||||
self.__cleanup() # for pedantic ones
|
||||
|
||||
##
|
||||
|
|
Loading…
Reference in New Issue