[omniORB] Forks, BOA, ports and persistence

Bjørn Wennberg bjornw@colargol.idb.hist.no
12 Jun 1999 00:55:59 +0200


"Gary D. Duzan" <gdd0@gte.com> writes:

> In Message <3760D598.4E67B8ED@adaptivebroadband.co.uk> ,
>    Nick Brook <ncb@adaptivebroadband.com> wrote:
> 
> =>Michel Vayssade wrote:
> =>> 
> =>> On Thu, 10 Jun 1999, Nick Brook wrote:
> =>> > associated with that object. In fact I can kill ALL the parents=
 /
> =>> > grandparents / etc. leaving only the children and STILL all the=
se ports
> =>> > are LISTENing. But there's no process around that could be doin=
g the
> =>> > LISTENing, unless the child process is somehow listening all ev=
ery port
> =>> > that has ever been used by a BOA. Weird.
> =>> 
> =>> when a process is LISTENing, there is a descriptor open on the so=
cket
> =>> when the process forks, the child heritates all descriptors
> =>> the child must close the descriptor associated with the initial
> =>> parent's socket
> =>> isn't ?
> =>> 
> =>
> =>Thanks Michel, 
> =>
> =>Any idea how I close down the descriptor in the child? I've tried
> =>shutdown on the boa but that doesn't work.
> 
>    I had a similar problem a while back with a non-CORBA related daemon
> process. It is usually a good idea to call close() on file descriptors
> above 2 after fork() and before exec*(). What the max file descriptor
> is will depend on your system, and I think it is typical to just pick
> some fairly large number (64, 256) as the max and ignore any errors
> from close().
> 
> 					Gary Duzan
> 					GTE Laboratories
> 

I didn't read the first message which started this discussion, but isn't
this a problem when an application exits before all data on the socket(s)
are read/written? If this is the case, the ports should be working after
a timeout-period of about 60 seconds or so (dependent of your OS of course).

However, you might want to have a look at setsockopt() and SOL_LINGER
Excerpt from the man-page:
...
       SO_LINGER  controls  the action taken when unsent messages
       are queued on socket and a close(2) is performed. If  the
       socket promises reliable delivery of data and SO_LINGER is
       set, the system  will  block  the  process  on  the  close
       attempt  until it is able to transmit the data or until it
       decides it is unable to deliver the information (a timeout
       period,  termed  the  linger interval, is specified in the
       setsockopt  call  when  SO_LINGER   is   requested)...
...

bjornw> 
-- 
-------------------------------------------------------
Bjørn Wennberg       email: bjornw@tihlde.org
                        ms: +47 959 92 657