Mailing List Archive

Cannot fork on FreeBSD; Unix questions.
Hi all,

Putting almost full load on a QMAIL machine I've configured with FreeBSD
(All incoming email, and a large portion of outgoing goes through it...), I'm
now starting to see the following errors:

Feb 18 08:31:10 proxy2-new qmail: 856272670.389909 delivery 2133: success: /usr/
local/bin/smtp-rewrite.sh:_Cannot_fork/cdbget:_usage:_cdbget_key/did_0+0+1/

Feb 18 08:31:05 proxy2-new qmail: 856272665.715195 delivery 2128: deferral: qmai
l-inject:_fatal:_unable_to_run_qmail-queue/
Feb 18 08:31:05 proxy2-new qmail: 856272665.723979 starting delivery 2138: msg 1
61292 to local fixup-desmith@switch.com@fixup

I presume I'll need to recompile the kernel to set certain limits higher, but I
thought I'd see if anyone on this list knows of another alternative, since most
of you appear to be Unix gurus :)

Also, the first error message appears to indicate that the message did go through,
despite the error. Could someone enlighten me how to change the following script
(called from alias/.qmail-fixup-default) so that the message will be deferred if
an error occurs? A deferral isn't a big deal, but having the header rewriting
work in a spotty fashion just doesn't cut it :(

#!/bin/sh
#
#JCR - This section performs From: address rewriting.
#
DBRESULT="`/usr/local/bin/cdbget \$SENDER < /etc/aliases.rev.cdb`"
if [ -n "$DBRESULT" ]; then
QMAILINJECT=f
QMAILUSER=$DBRESULT
export QMAILUSER QMAILINJECT
else
USER=$SENDER
export USER
fi
#
#JCR - This section intercepts messages to rnd2.switch.com, and rewrites them
# if needed.
#
DMY=`echo $EXT2 | /usr/bin/sed "/.*/y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmno
pqrstuvwxyz/"`
DBRESULT="`/usr/local/bin/cdbget \$DMY < /etc/rnd2.switch.com.remap.cdb`"
if [ -n "$DBRESULT" ]; then
EXT2=$DBRESULT
export EXT2
fi
#
#JCR - Ok, now reinject the message back into the mail system.
#
exec /var/qmail/bin/qmail-inject -f "$SENDER" -- "$EXT2"
exit 111
-------------------------
John C. Ring, Jr.
jcring@switch.com
Network Specialist
Union Switch & Signal Inc.
Re: Cannot fork on FreeBSD; Unix questions. [ In reply to ]
On Tue, 18 Feb 1997, John C. Ring, Jr. wrote:

> Putting almost full load on a QMAIL machine I've configured with FreeBSD
> (All incoming email, and a large portion of outgoing goes through it...), I'm
> now starting to see the following errors:

This sounds like systems resource limits kicking in to me. Maybe
have it exempt qmail from the limits? I know on a shadowed Linux box it
uses /etc/limits, I beleive BSDI does the same, I don't know about
FreeBSD.

-Dustin Marquess
Re[2]: Cannot fork on FreeBSD; Unix questions. [ In reply to ]
I wouldn't believe anything that comes from a site and id such as
jailbird@alcatraz. Norman

>On Tue, 18 Feb 1997, John C. Ring, Jr. wrote:
>
>> Putting almost full load on a QMAIL machine I've configured with FreeBSD
>> (All incoming email, and a large portion of outgoing goes through it...), I'm
>> now starting to see the following errors:
>
> This sounds like systems resource limits kicking in to me. Maybe
>have it exempt qmail from the limits? I know on a shadowed Linux box it
>uses /etc/limits, I beleive BSDI does the same, I don't know about
>FreeBSD.
>
> -Dustin Marquess
>
>
Re: Re[2]: Cannot fork on FreeBSD; Unix questions. [ In reply to ]
On Tue, 18 Feb 1997, Norman Bollinger wrote:
> I wouldn't believe anything that comes from a site and id such as
> jailbird@alcatraz. Norman

Haven't you got any better suggestions?

Try using ulimit, and see if your limits on the various qmail uid's are
set to too few # of processes. You may just be able to push up a soft
limit.

-Peter
Re: Cannot fork on FreeBSD; Unix questions. [ In reply to ]
Thanks to everyone who answered in this thread. I used ulimit -a from that
shell script to find that the process had a limit of 40; I put ulimit -u 100
to increase it to 100. That appears to have fixed the fork problem during
the shell which caused email to be sent without rewriting occuring. I'm still
seeing fork problems with qmail-alias, which I've yet to find how/what to
increase for this problem, but since that at least then defers, it's not as
high a priority to find.

(kern.maxproc = 180 or kern.maxprocperuid = 179 might be what I need to raise;
I'll try them when I have a chance :)
-------------------------
John C. Ring, Jr.
jcring@switch.com
Network Specialist
Union Switch & Signal Inc.
Re: Cannot fork on FreeBSD; Unix questions. [ In reply to ]
> /usr/local/bin/smtp-rewrite.sh:_Cannot_fork/cdbget:_usage:_cdbget_key

The real problem here is that sh doesn't have any notion of temporary
errors. If it can't invoke sed because it's out of memory or processes,
it should stop immediately. There's no easy way for a script writer to
detect this situation.

You should translate the script to C, using the cdb library routines for
lookups.

---Dan
Put an end to unauthorized mail relaying. http://pobox.com/~djb/qmail.html
Re: Cannot fork on FreeBSD; Unix questions. [ In reply to ]
> You should translate the script to C, using the cdb library routines for
> lookups.

Or, of course, Perl with the CDB_File module :-). The first alpha
release of CDB_File is available from CPAN.

Tim.