(RADIATOR) Re: problem with forking daemon and database connections

Mike McCauley mikem at open.com.au
Tue Dec 18 12:21:37 CST 2001


Hello Damir,

thanks for this. I can tell you have put a lot of effort into finding this 
problem.

We have rolled your code into the next release, but under the control of a 
new global parameter ForkClosesFDs which by default is off. If it does not 
break anyone, we will default it to on.

Cheers.


On Wed, 5 Dec 2001 11:07, Damir Dzeko wrote:
> Hello Mike,
>
> I had a strange and hard to trace problem with Radiator server
> that was connected to Oracle database (for maintaining session
> database and accounting) and had a handler (for IPASS requests)
> that would fork.
>
> Every time the server forked our radiusd would lose it's connection
> to database. That resulted in errors like:
>
>    ORA-03113: end-of-file on communication channel
>         (DBD ERROR: OCIStmtExecute)
>
> in the middle of a query execution. The problem was hard to trace
> because the reason for failure was not in the broken query but
> somewhere else.
>
> After many hours of work I discovered that closing a few file
> descriptors just after the daemon forked a child (in the child
> process) would prevent it from happening.
>
> Here are those few lines of code that do the job for me:
>
>     use IO::Handle;
>
> in file radiusd.pl, sub safeFork:
>
>     elsif (defined $pid)
>     {
>       # Child.
>
>       # <ddzeko>
>       #
>       # close kid's file descriptors ;>>>
>       # (this will teach the kid to stay out of
>       # parent's database business)
>       #
>       if (1) {
> 	my ($io) = new IO::Handle;
> 	for (my $i = 3; $i < 20; $i++) {
> 	  $io->fdopen($i, 'r') && $io->close;
> 	}
>       }
>       # </ddzeko>
>
>       return 1;
>     }
>
> Greetings,
>
> --damir;

-- 
I am travelling at the moment, and there may be delays in our correspondence.
Mike McCauley, Open System Consultants, mikem at open.com.au, www.open.com.au
===
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.


More information about the radiator mailing list