Possible bug with UDP and SO_REUSEADDR. Was Re: [PATCH] zerocopy NFS updated

Terje Eggestad
2002-04-25T12:37:49Z

Seeing this mail from Hirokazu my curiosity triggered, I'd never
contemplated using reuse on a udp socket.

However writing a test server that stand in blocking wait on a UDP
socket, and start two instances of the server it's ALWAYS the server
last started that get the udp message, even if it's not in blocking
wait, and the first started server is.

Smells like a bug to me, this behavior don't make much sence.

Using stock 2.4.17.

TJ

On Sat, 2002-04-20 at 09:47, Hirokazu Takahashi wrote:
> Hi,
>
> > > And it seems to be more important on UDP sendfile().
> > > processes or threads sharing the same UDP socket would affect each other,
> > > while processes or threads on TCP sockets don't care about it as TCP
> > > connection is peer to peer.
> >
> > No. It is not the lack of peer-to-peer connections that gives rise to the
> > bottleneck, but the idea of several threads multiplexing sendfile() through a
> > single socket. Given a bad program design, it can be done over TCP too.
> >
> > The conclusion is that the programmer really ought to choose a different
> > design. For multimedia streaming, for instance, it makes sense to use 1 UDP
> > socket per thread rather than to multiplex the output through one socket.
>
> You mean, create UDP sockets which have the same port number?
> Yes we can if we use setsockopt(SO_REUSEADDR).
> And it could lead less contention between CPUs.
> Sounds good!
>
> Thank you,
> Hirokazu Takahashi.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
_________________________________________________________________________

Terje Eggestad mailto:terje.eggestad@scali.no
Scali Scalable Linux Systems http://www.scali.com

Olaf Helsets Vei 6 tel: +47 22 62 89 61 (OFFICE)
P.O.Box 150, Oppsal +47 975 31 574 (MOBILE)
N-0619 Oslo fax: +47 22 62 89 51
NORWAY
_________________________________________________________________________