[Mimedefang] relay_is_blacklisted_multi() multithreading problems?

Jan Pieter Cornet johnpc at xs4all.nl
Thu Apr 23 18:19:11 EDT 2009

On Thu, Apr 23, 2009 at 04:04:58PM +0200, Erik Hensema / HostingXS wrote:
> > "Erik Hensema / HostingXS" <hensema at hostingxs.nl> wrote:
> > > However, in some (rare) cases relays are blocked even though there are
> > > whitelisted and not blacklisted on any blacklist.
> > > I can't see how this can be caused by my filter code.
> >
>         my $ans = relay_is_blacklisted_multi($RelayAddr, 5, $required, 
> \@dnsbls);
>         my $count = 0;
>         foreach my $domain (keys(%$ans)) {
>                 my $r = $ans->{$domain};
>                 if(ref($r) eq "ARRAY") {
>                         push @dnsbl_positive, $domain;

My guess is: do you forget to clear @dnsbl_positive at the start of the
function? Good practice is to avoid global variables as much as
possible, and to make sure you run your code under "use strict" and "use
warnings" (yes, even in produktion - warnings end up in the maillog

Every case I've seen where such unpredictable behaviour was seen, which
could not be (easily) reproduced while testing, was a case of state
variables "leaking" values from one call to the next.

Jan-Pieter Cornet <johnpc at xs4all.nl>
!! Disclamer: The addressee of this email is not the intended recipient. !!
!! This is only a test of the echelon and data retention systems. Please !!
!! archive this message indefinitely to allow verification of the logs.  !!

More information about the MIMEDefang mailing list