mail loop problems: was: Re: [rt-users] RT/Apache suddenly hangs
Tomas Olaj
tomas.olaj at usit.uio.no
Wed Feb 7 05:38:33 EST 2007
Hi,
We have checked the problem more closesly, and the reason why our
RT/Apache server stops is due to different variants of mail loops.
We still have problems with other loop variants consuming all resources.
Extended mailgate errors leading to loops, spam going into loop. How can
we make mailgate a bit more smarter?
Does anyone have a mail loop detector in front of their RT installations.
We have a high severity now with our RT in production. The load is
increasing all the time.
Our commonly used cron-script removing some mail loops:
#!/site/perl-5.8.7/bin/perl
#
# Author: Petter Reinholdtsen
# Date: 2006-01-13
# License: GNU Public License v2 or later
#
# Look at all tickets, and remove all queue addresses from requestor,
# cc and admincc. This reduces the amount of bounce emails sent to
# the RT admins.
use warnings;
use strict;
use Getopt::Std;
# Location of RT's libs and scripts
# Remember to change to correct path on current RT instance
use lib ("/site/rt3/local/lib", "/site/rt3/lib");
package RT;
use RT::Interface::CLI qw(CleanEnv);
use RT::Queue;
use RT::Queues;
use RT::Tickets;
my %opts;
Getopt::Std::getopts("dn", \%opts);
my $debug = $opts{'d'} || 0;
my $dryrun = $opts{'n'} || 0;
$| = 1;
# Find all queue addresses of enabled queues
my @queueaddrs =
(
# Aliases for e-mail lists are listed here:
'e-mail-list at domain.com',
);
my $ticketcount = 0;
my $starttime = time();
CleanEnv(); # Clean our the environment
RT::LoadConfig(); # Load the RT configuration
RT::Init(); # Initialise RT
my $user = RT::User->new( $RT::SystemUser );
# Merge static list with dynamic list
@queueaddrs = (load_queue_addresses(), @queueaddrs);
# Loop over all addresses, remove them from the tickets were they are
# registered as watchers
for my $address( sort @queueaddrs ) {
print "Removing address '$address' from all tickets\n" if $debug;
my $tickets = new RT::Tickets($RT::SystemUser);
$tickets->FromSQL( "Watcher.EmailAddress = '$address'" );
while( my $ticket = $tickets->Next ) {
$ticketcount++;
my $id = $ticket->Id;
if ($dryrun) {
print "Want to remove $address as watcher from ticket #$id\n";
} else {
$RT::Logger->info("Removed queue address $address as watcher
".
"from ticket #$id");
$ticket->DeleteWatcher(Email => $address, Type => $_ )
for( qw(Cc AdminCc Requestor) );
}
}
}
my $duration = time() - $starttime;
$RT::Logger->info("Processing of $ticketcount tickets took $duration
seconds");
sub load_queue_addresses {
my $queues = new RT::Queues($RT::SystemUser);
$queues->LimitToEnabled();
my @queueaddrs;
foreach my $queue (@{$queues->ItemsArrayRef()}) {
for my $address ($queue->CorrespondAddress,
$queue->CommentAddress) {
next unless $user->LoadByEmail( $address );
push @queueaddrs, $address;
print "Found queue address '$address'\n" if $debug;
}
}
return @queueaddrs;
}
--
________________________________________________________________________
Tomas A. P. Olaj, email: tomas.olaj at usit.uio.no, web: folk.uio.no/tomaso
University of Oslo / USIT (Center for Information Technology Services)
System- and Application Management / Applications Management Group
More information about the rt-users
mailing list