Subject: | Proc::Reliable fails intermittantly on RedHat 7.3 |
We have several RH 7.3 and 7.1 boxes that use the following code to check email addresses by calling the local MTA (exim) with it's address tester.
sub isValidEmail
{
# Proc::Reliable for safely executing system calls
use Proc::Reliable;
# RFC::RFC822::Address for syntax checking
use RFC::RFC822::Address qw(valid);
my $address = shift;
my $syntax_only = shift;
my $exim = "/usr/local/sbin/exim";
# Split the address into left- and right-hand sides
my ($lhs, $rhs, $xtra) = split('\@', $address);
# Check that we got both sides and nothing extra and use
# the valid() sub from the RFC822 module to check syntax
$RFCCheck = valid($address);
#if ($lhs && $rhs && !$xtra && valid($address))
if ($lhs && $rhs && !$xtra && $RFCCheck)
{
# quit and return true if we're only checking syntax
return 1 if $syntax_only;
# turning off shell access because it sounds more secure and
# doesn't appear to be necessary for what we're doing
my $cmd = new Proc::Reliable("maxtime" => 20, "num_tries" => 5,
"child_exit_time" => 5, "allow_shell" => 0);
my ($out, $err, $status, $msg) = $cmd->run([$exim, "-bt", $address]);
if (!$status && !$err)
{
return 1;
}
# log to Apache files
print STDERR "\nEMAIL INVALID: Exim email validation found probl
em with '$address' - status $status, error $err, msg $msg, out $out\n";
return 0;
}
else
{
# log to Apache files
print STDERR "\nEMAIL INVALID: Syntax check found problem with '
$address' - lhs $lhs, rhs $rhs, xtra $xtra, RFC822 check $RFCCheck\n";
return 0;
}
}
The normal output of exim -bt looks like the following:
134 [porter][1:08pm][bin]# exim -bt blah@fsckit.net
blah@fsckit.net
deliver to blah@fsckit.net
router = lookuphost, transport = remote_smtp
host pulse.fsckit.net [12.98.14.70] MX=10
host ice-weasel.smarterliving.net [66.228.74.146] MX=15
135 [porter][1:10pm][bin]# echo $?
0
136 [porter][1:10pm][bin]# exim -bt blah@nosuchdomainexists.com
blah@nosuchdomainexists.com is undeliverable:
unrouteable mail domain "nosuchdomainexists.com"
137 [porter][1:10pm][bin]# echo $?
2
138 [porter][1:10pm][bin]# exim -bt blah@example.
blah@example. - bad address: domain missing or malformed
139 [porter][1:11pm][bin]# echo $?
2
The problem we're having is that on the RH 7.3 box but not the 7.1 boxes we randomly see failures in the cgi in which this code runs where Proc::Reliable sees no return status from exim:
EMAIL INVALID: Exim email validation found problem with 'somerandomuser@hotmail.com' -
status -1, error , msg no return status from subprocess
, out somerandomuser@hotmail.com
deliver to somerandomuser@hotmail.com
router = lookuphost, transport = remote_smtp
host mx2.hotmail.com [65.54.166.230] MX=5
host mx2.hotmail.com [65.54.252.230] MX=5
host mx2.hotmail.com [65.54.254.145] MX=5
host mx4.hotmail.com [65.54.254.151] MX=5
host mx4.hotmail.com [65.54.253.230] MX=5
host mx1.hotmail.com [65.54.166.99] MX=5
host mx1.hotmail.com [65.54.252.99] MX=5
host mx1.hotmail.com [65.54.254.129] MX=5
host mx3.hotmail.com [65.54.254.140] MX=5
host mx3.hotmail.com [65.54.253.99] MX=5
I suspect that what might be happening is that it's not waiting on the completion of exim's test before continuing. On the RH7.1 boxes this failure never occurs.
Perl details (from the RH7.3 box):
Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
Platform:
osname=linux, osvers=2.4.17-0.13smp, archname=i386-linux
uname='linux daffy.perf.redhat.com 2.4.17-0.13smp #1 smp fri feb 1 10:30:48 est 2002 i686 unknown '
config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dcccdlflags=-fPIC -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Uusethreads -Uuseithreads -Uuselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Di_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
Compiler:
cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/local/include',
optimize='-O2 -march=i386 -mcpu=i686',
cppflags='-fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.2 2.96-109)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldl -lm -lc -lcrypt -lutil
perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
libc=/lib/libc-2.2.5.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options:
Built under linux
Compiled at Apr 1 2002 12:23:22
@INC:
/usr/lib/perl5/5.6.1/i386-linux
/usr/lib/perl5/5.6.1
/usr/lib/perl5/site_perl/5.6.1/i386-linux
/usr/lib/perl5/site_perl/5.6.1
/usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.6.1/i386-linux
/usr/lib/perl5/vendor_perl/5.6.1
/usr/lib/perl5/vendor_perl
From the RH7.1 box:
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
Platform:
osname=linux, osvers=2.2.17-8smp, archname=i386-linux
uname='linux porky.devel.redhat.com 2.2.17-8smp #1 smp fri nov 17 16:12:17 est 2000 i686 unknown '
config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -Dcc=gcc -Dcccdlflags=-fPIC -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dd_dosuid -Dd_semctl_semun -Di_db -Di_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Uuselargefiles'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=undef
use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
Compiler:
cc='gcc', optimize='-O2 -march=i386 -mcpu=i686', gccversion=2.96 20000731 (Red Hat Linux 7.1 2.96-79)
cppflags='-fno-strict-aliasing'
ccflags ='-fno-strict-aliasing'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldl -lm -lc -lcrypt
libc=/lib/libc-2.2.2.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options:
Built under linux
Compiled at Mar 23 2001 12:49:50
@INC:
/usr/lib/perl5/5.6.0/i386-linux
/usr/lib/perl5/5.6.0
/usr/lib/perl5/site_perl/5.6.0/i386-linux
/usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl
.
The same version of Proc::Reliable (latest) is installed on both systems.
Any thoughts on what the problem is here? Any suggestions on a fix or a workaround? If you need any further data, please let me know.
Thanks,
Tabor