error from pipe in sendmail alias

N

nickname

Hello,

I posted this on a sendmail group, to no avail. Any suggestions about
tightening up the code or making it 'nicer' is appreciated as well.

I have an alias consisting of a pipe to a perl script and a username as
well,

web1: "| /home/sellis/bin/email-filter.pl",robert

I am getting the desired results from this; a copy of the email goes to
robert's mailbox, and a copy is processed by email-filter.pl. However
I'm seeing errors in my maillog and messages as follows,

maillog, stat=unknown mailer error 137

and messages, /kernel: pid 94738 (perl), uid 26, was killed: out of
swap space

I'm wondering how to track this down, or what I could be doing wrong.
If I run the script from the command line it terminates right away; I
specifically added a line to tell the script to exit.

I am using sendmail version 8.12.11,
thanks for any suggestions,

ta, Sean


code follows,

#!/usr/bin/perl -w

use strict;

use Email::Filter;
use DBI;

my
($first_name,$last_name,$name,$fname,$lname,$address_1,$city,$state,$zip,$country,$phone_1,$user_email);

my $user_id = `/usr/home/sellis/bin/make-user_id.php`;
my $address_type = "BT";
my $default_last_name = "NONE";
my $timestamp = time;
my $vendor_id = "1";
my $shopper_group_id = "15";
my $password = "XXXXXX";
my $perms = "shopper";

my $dsn = "DBI:mysql:some_db";
my $db_user = "db_user";
my $db_pass = "XXXXXX";

my $mail = Email::Filter->new(emergency =>
"/usr/home/sellis/mail/webforms");

exit 0 if $mail->subject !~ /FORM POST/;

my $conn = DBI->connect($dsn, $db_user, $db_pass) or die $DBI::errstr;

my $body = $mail->body;

my @responses = split "\n", $body;
foreach my $line (@responses) {

next unless defined $line;

if ($line =~ /^Fname\s+: (.*)$/) {
# print "$1\n";
$fname = $1;
}
if ($line =~ /^Lname\s+: (.*)$/) {
# print "$1\n";
$lname = $1;
}


MORE ASSIGNMENT STUFF LIKE ABOVE SNIPPED FOR BREVITY

}

$first_name = $fname || $name;
$last_name = $lname || $default_last_name;


doSQL($conn, "INSERT INTO user_info (user_id, address_type, last_name,
first_name, phone_1, address_1, city, state, country, zip, user_email,
cdate, mdate) VALUES
('$user_id','$address_type','$last_name','$first_name','$phone_1','$address_1','$city','$state','$country','$zip','$user_email','$timestamp','$timestamp')");

doSQL($conn, "INSERT INTO shopper_vendor_xref (user_id, vendor_id,
shopper_group_id) VALUES
('$user_id','$vendor_id','$shopper_group_id')");

doSQL($conn, "INSERT INTO auth_user_md5 (user_id, username, password,
perms) VALUES ('$user_id','$timestamp','$password','$perms')");

$conn->disconnect;

sub doSQL {
my ($conn, $command) = @_;
# print $command, "\n";
my $sth = $conn->prepare($command);
my $nrows = $sth->execute;
# print "status is ", $DBI::err, "\n" if $DBI::err;
# print "number of rows affected is ", $nrows, "\n";
# print "error message: ", $DBI::errstr, "\n" if $DBI::err;
}

exit 0;
 
J

Joe Smith

nickname said:
maillog, stat=unknown mailer error 137

Sometimes error code 137 is 9 + 128 = Segmentation fault, core dumped.
and messages, /kernel: pid 94738 (perl), uid 26, was killed: out of
swap space

That happens when your program gets into an infinite loop constantly
allocating memory. Try printing progress messages to a log file.
-Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top