[prev in list] [next in list] [prev in thread] [next in thread] 

List:       list-managers
Subject:    Re: Bouncing loops
From:       nb () thinkcoach ! com
Date:       2000-01-14 8:33:44
Message-ID: 200001140833.JAA00678 () quill ! thinkcoach ! com
[Download RAW message or body]

> Manager replies to request, and attach the request message to the end of
> the mail body. Request received it, and replied to manager, and so, and so,
> and so. With chance, both have length limitation and the message didn't grew
> up to much, but it bounce during all a nite long...
> 
> So my questions are in fact, how List servers handle and
> manage this, with what technics etc? I never want such a thing in my life.
> 
> What is the best software that fight this. How they can fight
> this, I would be sure to not have it again.

I'm writing all my email robots in Perl, and they all use a
module which implements the following limit() function. The idea
is that a limit is imposed all action, so that whenever what
looks like essentially the same action happens over and over
again, eventually the email robot will just ignore similar
messages silently for the rest of the day.

So for example, the first five subscription requests for the
same list and the same email address will be processed
normally. After that, the next five requests will not be
processed, but will be returned to the sender with an
explanation that a certain limit has been exceeded. The eleventh
subscription requests for the same list and the same email
address will be forwarded to the site administrator to alert him
that there is a problem. Any further subscription requests for the
same list and the same email address will be silently ignored.

I make use of all this functionality with a single line like

limit(%msg,5,5,"subscrition_request_limit",$list,$addr);

so that my laziness won't stop me from implementing this limit
for every action that the email robot can possibly take.

Warm greetings, Norbert.



# limit()    - Limits the number of times that essentially the same action
#            will be performed on any single day, to prevent all kinds of
#            disastrous mail loops.
# arguments: the message that triggered this action
#            number of times the action may be performed
#            number of times this function will generate an error response
#            filename for the notification message to use when the limit
#              is exceeded
#            additional data for uniquely determining what is "essentially
#              the same action"; these are also available as replacement
#              arguments in the notification message.
# returns:   nothing
# example:   limit(%msg,5,5,"subscrition_request_limit",$list,$addr);

sub limit(\%$$@) {
  my %msg=%{shift @_};
  my $limit=shift;
  my $errlimit=shift;
  my $id=join(":",@_);
  my $txtfile=shift;

  db_midnightsweep("limit.db");
  my $c=db_get("limit.db",$id);
  $c ||= 0;
  $c++;
  db_put("limit.db",$id,$c);
  if ($c>$limit+$errlimit+5) {
    wlog("Limit exceeded, response and alert suppressed: $id");
    exit;
  } elsif ($c==$limit+$errlimit+5) {
    wlog("Limit exceeded, response suppressed, last alert: $id");
    mforward("limit ($limit) exceeded for $id\n\nThis is the last time for today that \
you will be alerted\nconcerning this limit; all further alerts will be \
suppressed.",$msg{'text'});  exit;
  } elsif ($c>$limit+$errlimit) {
    wlog("Limit exceeded, response suppressed, alerting: $id");
    mforward("limit ($limit) exceeded for $id",$msg{'text'});
    exit;
  } elsif ($c>$limit) {
    wlog("Limit exceeded, responding: $id");
    respond(%msg, $errto, $txtfile, @_);
    exit;
  }
}




May blessings from the eternal God surprise and overtake you!
                                                                Norbert.

-- 
Norbert Bollow, Weidlistr.18, CH-8624 Gruet (near Zurich, Switzerland)
Tel +41 1 972 20 59      Fax +41 1 972 20 69     http://thinkcoach.com


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic