On 2004.02.21, Taguchi Takeshi <[EMAIL PROTECTED]> wrote:
> Log file said:
> [21/Feb/2004:21:06:55][52251.134557696][-main-] Warning: prebind: closed unused: 
> 10.0.0.6:80 = 3
>                                                 
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ HERE!!!!
> [21/Feb/2004:21:06:55][52251.134560768][-nssock:driver-] Notice: starting
> [21/Feb/2004:21:06:55][52251.134560768][-nssock:driver-] Warning: 
> DEBUG:SockListenEx: called: 10.0.0.6:80
>   ...[snip]....
>
> Ns_SockListenEx() is called after executing NsClosePreBound().
> NsClosePreBound() close the socket port 80, and remove it from
> hash table.
> So Ns_SockListenEx() can not find socket from hash table!!!
>
> Is this correct?

Apparently, that's what seems to be happening.  I just recalled from
your previous log file posting:

> [20/Feb/2004:22:35:43][72901.134557696][-main-] Notice: nsmain: AOLserver/4.1 running
> [20/Feb/2004:22:35:43][72901.134557696][-main-] Notice: nsmain: security info: 
> uid=80, euid=80, gid=80, egid=80
> [20/Feb/2004:22:35:43][72901.134559744][-sched-] Notice: sched: starting
> [20/Feb/2004:22:35:43][72901.134557696][-main-] Notice: driver: starting: nssock
> [20/Feb/2004:22:35:43][72901.134557696][-main-] Warning: prebind: closed unused: 
> 10.0.0.6:80 = 3
> [20/Feb/2004:22:35:43][72901.134560768][-nssock:driver-] Notice: starting
> [20/Feb/2004:22:35:43][72901.134560768][-nssock:driver-] Fatal: nssock: failed to 
> listen on 10.0.0.6:80: Permission denied

First off: You're running the AOLserver 4.1.  Have you tried AOLserver
4.0.x yet?  Does it have the same problem?

nsd/driver.c:NsStartDrivers() behavior changed from 4.0 to 4.1.  In 4.0,
NsStartDrivers would listen on all the sockets then kick off threads
running DriverThread().  In 4.1, the listening part was pushed down into
DriverThread, and NsStartDrivers would just start up all the
DriverThreads then return.  Why we're seeing this race condition
("driver: starting: nssock" then "prebind: closed unused: ...") is
because in 4.0 and 4.1, nsmain.c:Ns_Main() looks like this:

    576     /*
    577      * Start the drivers now that the server appears ready
    578      * and then close any remaining pre-bound sockets.
    579      */
    580
    581     NsStartDrivers();
    582 #ifndef _WIN32
    583     NsClosePreBound();
    584 #endif

So, in 4.0, NsStartDrivers would at least Ns_SockListenEx before
starting the DriverThreads, so when NsStartDrivers returned and
NsClosePreBound is invoked, the sockets would all be listen'ed to so
they wouldn't get closed by NsClosePreBound.

In 4.1, it's conceivable that NsStartDrivers starts all the
DriverThreads, and before the threads get a chance to Ns_SockListenEx,
NsStartDrivers has already returned and now Ns_Main has already called
NsClosePreBound.

I'm not keen on pulling the NsSockListenEx back up into NsStartDrivers,
but if we don't, then we need to add code either to NsStartDrivers or in
Ns_Main so that we wait until all DriverThreads are fully started BEFORE
moving on to executing NsClosePreBound.

What probably ought to be done another boolean "started" needs to be
added to nsd/nsd.h's Driver struct, and a new NsWaitDriversStartup needs
to be called that waits for all drivers to start before leaving
NsStartDrivers.

Anyone see a reason why this is a bad idea?

-- Dossy


--
Dossy Shiobara                       mail: [EMAIL PROTECTED]
Panoptic Computer Network             web: http://www.panoptic.com/
  "He realized the fastest way to change is to laugh at your own
    folly -- then you can let go and quickly move on." (p. 70)


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of 
your email blank.

Reply via email to