2001-03-12 13:18:48

by Johan Adolfsson

[permalink] [raw]
Subject: select()/accept() problem in 2.0.38

In short:
My listener socket _sometimes_ gets confused when a client
connect and closes very fast when the server has outstanding data.

The read fd_set with the listener socket is not set
by the select() call for new connections,
but if I do accept() on it anyway I will get the new socket!

I know this could happen anyway but if I don't do the accept()
the fd_set will not be set and the application will not handle
any new connections.
New clients will think they are connected depending on the
backlog parameter to listen(), and then they will timeout.

More details:
I use non-blocking sockets.

The select() has a timeout of 20ms since I need to
poll the serial port status pins.

I don't get this on 2.4.

When it happens I get a EPIPE from write(),
(sometimes it works but then I usually get ECONNRESET instead
of EPIPE but not always)
It seems to be timing dependent.

Any ideas?

/Johan