From 16322440edf3f9bcf2a920799d4ab4cd09f57c91 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 21 Nov 2011 19:36:48 -0500 Subject: [PATCH] BF: stop all communications before stopping the jails (Close gh-7) It is necessary because otherwise if jails actions try to communicate to the server we are getting a lockup since threads are locked --- server/server.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/server.py b/server/server.py index 38ddd48b..12c041e5 100644 --- a/server/server.py +++ b/server/server.py @@ -107,9 +107,15 @@ class Server: self.__loggingLock.release() def quit(self): - self.stopAllJail() - # Stop communication + # Stop communication first because if jail's unban action + # tries to communicate via fail2ban-client we get a lockup + # among threads. So the simplest resolution is to stop all + # communications first (which should be ok anyways since we + # are exiting) + # See https://github.com/fail2ban/fail2ban/issues/7 self.__asyncServer.stop() + # Now stop all the jails + self.stopAllJail() def addJail(self, name, backend): self.__jails.add(name, backend)