(RADIATOR) fix for problem with forking daemon and database connections (Oracle)

Damir Dzeko damir.dzeko at iskon.hr
Thu Dec 6 04:17:41 CST 2001


Hello,

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 that dirty hack that did 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;

===
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