[systemd-backend] implicit closing journal descriptor by stop filter.

Partially cherry-picked from 0.10 (d153555a07)
pull/1787/head
sebres 2017-05-19 15:36:06 +02:00
parent 0a707d0302
commit c7ddf1f940
2 changed files with 9 additions and 0 deletions

View File

@ -15,6 +15,8 @@ releases.
### Fixes
* Fix for systemd-backend: fail2ban hits the ulimit (out of file descriptors), see gh-991.
Partially back-ported from v.0.10.
### New Features

View File

@ -291,6 +291,13 @@ class FilterSystemd(JournalFilter): # pragma: systemd no cover
except FailManagerEmpty:
self.failManager.cleanup(MyTime.time())
# close journal:
try:
if self.__journal:
self.__journal.close()
except Exception as e: # pragma: no cover
logSys.error("Close journal failed: %r", e,
exc_info=logSys.getEffectiveLevel()<=logging.DEBUG)
logSys.debug((self.jail is not None and self.jail.name
or "jailless") +" filter terminated")
return True