Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#23 Unnecessary Wakeups - ~30/second

closed-fixed
Cyril Jaquier
None
5
2007-09-09
2007-08-07
David Rees
No

When running fail2ban on an idle system (Fedora Core 7) powertop (http://www.linuxpowertop.org/) is reporting that fail2ban-server wakes up about 30 times a second. This keeps the CPU from lower power states and on notebooks can significantly affect battery life.

I've had a quick scan through the code and can't find any obvious offenders (all sleeps seem to be on the order of 1 second), but I'm not a python hacker.

Discussion

  • Cyril Jaquier
    Cyril Jaquier
    2007-08-15

    Logged In: YES
    user_id=933467
    Originator: NO

    The attached patch should fix those frequent weak-ups. However, SIGINT and SIGTERM will NOT work anymore. You can still use "fail2ban-client stop" to terminate the server. A better fix is needed.

    This bug is related to this one:

    https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1167930&group_id=5470

    Any suggestion?
    File Added: fail2ban-remove-join-workaround.diff

     
  • Cyril Jaquier
    Cyril Jaquier
    2007-08-15

    • assigned_to: nobody --> lostcontrol
    • status: open --> open-accepted
     
  • David Rees
    David Rees
    2007-08-16

    Logged In: YES
    user_id=635799
    Originator: YES

    Thanks, that patch reduces the number of wakeups from 28/second to 3/second. I think there are a couple of polling loops which are waking fail2ban up, but it's much better now (it still wakes up the most on an idle server with Apache, Postgres, Postfix, Dovecot)

    In the bug you refer to it mentions that the signal/join bug is fixed in Python 2.5.1. Have you been able to verify? My most recent systems (Fedora 7) only have Python 2.5.

    Either way, since fail2ban still is able to shut down using the fail2ban-client stop command, the lack of TERM/INT signal handling isn't an issue for me.

     
  • Cyril Jaquier
    Cyril Jaquier
    2007-09-09

    Logged In: YES
    user_id=933467
    Originator: NO

    Fixed correctly in 0.9 branch.

    I replaced my own socket server implementation with asyncore/asynchat which is probably a lot better than what I have done ;)

    There are still some wake-ups. I will try to remove them too.

     
  • Cyril Jaquier
    Cyril Jaquier
    2007-09-09

    • status: open-accepted --> closed-fixed