rlm_perl forking zombies
Stephen Gran
steve at lobefin.net
Thu Jun 15 18:16:29 CEST 2006
On Thu, Jun 15, 2006 at 05:42:45PM +0200, david.suarezdelis at telefonica.es said:
> Greetings,
>
> I have FreeRadius 1.1.0 working on Debian 3.1 on an Intel box.
>
> When using rlm_perl, the authenticate() sub does its job and, eventually,
> calls a method to send an email to a certain address before returning OK.
>
> The problem is that this SMTP connection can take longer than wished,
> therefore I am forking the SMTP call, so the authentication process can go
> on as normal.
>
> The problem with this solution, though, is that--as I cannot wait for the
> SMTP connection to be done--the process is left as a zombie. I have,
> therefore, used a double forking solution, where the grandfather returns
> inmediately to the authorize() function, and the child forks again, and
> waits (waitpid()) for the new (grand)child to do the job, so no zombie is
> created.
>
> By itself, this works and no zombies are left behind, as expected. However,
> when used with FreeRadius, zombies are left behind. I have tried to
> 'IGNORE' SIGCHLD, to use reaper function (and all the other tricks in
> perlipc(1)) to no avail (I am even using Proc::Fork to simplify things so I
> am sure I am doing things properly).
>
> Is this a problem with my calling this inside the authenticate() function,
> or with rlm_perl, or...? Is this a problem with 1.1.0 and solved with a
> later version?
I can't tell you without seeing the script, but the way I would handle
this (if I understand correctly) would be two fold. First, set up a
signal handler for SIGCHLD that is a callback to a subroutine that calls
waitpid(). Then, at the end of your script, if you haven't received
SIGCHLD, and you're about to exit, jump to the routine that handles
SIGCHLD. Then go back to just using a single fork. You could
presumably track whether you're even supposed to have a child out there
with a variable, so as to skip the jump at the end if you've already
reaped your child process.
My advice herre may be wrong, of course - I do not use rlm_perl, but I
do use perl fairly regularly.
--
--------------------------------------------------------------------------
| Stephen Gran | God is dead and I don't feel all too |
| steve at lobefin.net | well either.... -- Ralph Moonen |
| http://www.lobefin.net/~steve | |
--------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20060615/60acb226/attachment.pgp>
More information about the Freeradius-Users
mailing list