Weird error with SQL lookups in amavisd

Guus Leeuw jr guus.leeuw at itpassion.com
Sat Apr 14 08:25:15 CEST 2012


Mark,

> Guus,
>
> > I upgraded my smtp box from Fedora 13 to Fedora 15, also upgraded 
> > amavisd in the process.
> > 
> > According to amavisd, I'm now at 2.6.6, and I keep getting the 
> > following
> > errors:
> > Apr 12 15:07:02 smtp amavis[10332]: (10332-02) (!)lookup_sql: Can't 
> > use an undefined value as an ARRAY reference at (eval 78) line 257, 
> > <GEN20> line 3., , Apr 12 15:07:02 smtp amavis[10332]: (10332-02) 
> > (!!)TROUBLE in
> > process_request: Can't use an undefined value as an ARRAY reference at 
> > (eval 78) line 257, <GEN20> line 3. at (eval 78) line 282, <GEN20> line
3.
> > Apr 12 15:07:02 smtp amavis[10332]: (10332-02) (!)Requesting process 
> > rundown after fatal error
> > 
> > Anybody seen this or has a solution, or even a way of figuring out 
> > what Perl actually means to say with "eval 78" <GEN20>, line 257, line 
> > 282, or line 3?
>
> Lines 257 and 282 are relative to a package Amavis::Lookup::SQLfield,
counting from a __DATA__ line.
>
> Search forward for:
>   sub lookup_sql(
> then search backwards for:
>   __DATA__
> then go down 257 lines, arriving at or near:
>       $match = {}; @$match{@names} = @$a_ref;
>
> The 282 then corresponds to a
>     die $err;
> a bit further down, which caught the eval failure and propagated it
further.
>
> This is the area in question:
>
>     $conn_h->execute($sel, at pos_args);  # do the query
>     # fetch query results
>     while ( defined($a_ref=$conn_h->fetchrow_arrayref($sel)) ) {
>       my(@names) = @{$conn_h->sth($sel)->{NAME_lc}};
>       $match = {}; @$match{@names} = @$a_ref;
>       if ($self->{clause_name} eq 'sel_policy' &&
>           !exists $match->{'local'} && $match->{'email'} eq '@.') { [...]
>   } or do {
>     my($err) = $@ ne '' ? $@ : "errno=$!";  chomp $err;
>     do_log(-1, "lookup_sql: %s, %s, %s", $err, $DBI::err, $DBI::errstr);
>     die $err  if $err =~ /^timed out\b/;  # resignal timeout
>     die $err;
>   };
>
>
> > lookup_sql: Can't use an undefined value as an ARRAY reference at 
> > (eval 78) line 257
>
> Puzzling. The   "while (defined($a_ref..."   should ensure that
> we only enter the loop when $a_ref is defined, yet the @$a_ref appparently
thinks it is undefined. I could be wrong by a line or two, but this is the
area that needs to be investigated. I don't see what could be wrong there,
nor do I remember seeing a
> similar report.
>
> Perhaps adding a couple of calls to do_log in that area would shed some
light on the problem.

I'll certainly do that when testing during next week...

>
> Btw, which version of perl is running now, and which version of amavisd
was running before the upgrade.

Perl is now at 5.14, amavisd-maia was running before, which was branched off
of 2.2.1. I've tried standard amavisd with postvis: Same problem... Tried
standard amavisd with the old amavis-maia database, all to no avail.

As I said: I'll be using the above tips to run some more testing next week,
so I'll provide more answers then.

Thanks so far,
Regards,
Guus



More information about the amavis-users mailing list