This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

forked child inherits socket: bug? (MetaHTML-5.09 with cygwin-b20)


jarlath@oisin.com wrote:
> 
> Hey John,
> 
> Thanks VERY much for this info. it will be very helpful in getting to

Bad news, I'm afraid.
It seems that the current forking mechanism in cygwin loses inherited
sockets.
This is my current theory, anyway..
A sniff of the net io for mhttpd looks something like:
CLI: syn
SRV: syn ack
CLI: ack
CLI: push ".. POST blah blah .."
CLI: push ".. blah" (post in 2 packets)
SRV: " .. 302 found .."
SRV: RESET (other packets of response not sent)
SRV: RESET

My telnet investigations see the input-stream closed after the first
packet ( shutdown(connection,1); ? ), after which the server
sends one packet, then 2 resets.
So I'm theorising that:
 a) The server parent process accept()'s the first packet
 b) parent forks a child, which inherits the connection
    I'm not sure if the child is expected to finish reading the client
    input stream here, or what. It doesn't, anyway..
 c) parent closes the connection (server.c:1130)
 d) cygwin starts new process, copies datasegments, re-initialises dlls
    Because cygwin now only loads the socket-io dll on demand,
     I guess the the dll initialisation routines differ.
     deserves more investigation..
 e) child sends a first packet
 f) child sends a reset. This implies that the stack somehow lost
    the session, probably because the parent was time-sliced, during
    which time it closed the connection, causing the client's next write
    to result in a reset.
    I could be way off the mark here; take this with a pinch of salt,
    just guessing really. Deserves some test-case code, sorry I don't
    have time ...
 g) child sends a _second_ reset. maybe provoked by it's attempt
    to perform a close operation, or a send a second packet.
A test-case that forks a child expecting an inherited tcp connection
should be easy enough to devise.
I tried loading the mod_metahtml in apache, but I've had some
difficulty with the fact that the win32 relase of apache and cygwin
use different build tools.. somebody has 'ported' the apache unix
source tree to cygwin, or at least they did for cyg-beta-19,
but I havn't tried this.

I also had trouble, specifically, with lots of hidden path-dependancies
in metahtml (sometimes ${prefix}, sometimes '/www' all over the
place), so at this point I decided that I'd be much better off
running linux.

Recommend an ODBC driver for linux?

John
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]