Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Dec 1998 14:31:26 +0100
From:      Dirk-Willem van Gulik <dirk.vangulik@jrc.it>
To:        freebsd-hackers@FreeBSD.ORG, Dirk-Willem van Gulik <Dirk.vanGulik@jrc.it>
Subject:   EADDRINUSE rather than EADDRNOTAVAIL
Message-ID:  <367664AE.D50A3A75@jrc.it>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------8FBF35BCE937F5FCD1814F39
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I've got a small database transaction client/server pair. It is
to accomplish serialisation of a db shared by a couple of web
servers on a handfull of machines. The backend is DD; typical
transaction speeds are in the 50/client/second; and 1500/server/second.

The client is nothing special; just a socket(); connect() to
a port/ip on the server.

As the client connects from a web server; from several children
it is common to have 100-dreds of connections open.

Now occasionally I get a EADDRINUSE when I try to connect(2). 
Specifically when we re-start the deamons often for debugging
and testing; or when a few are under heavy load, and I try to
add new onws.

Looking at in_pcb.h, where the error seems to come from, a EADDRNOTAVAIL 
would make sense. But I get an EADDRINUSE, which I cannot quite fit
with the client sort of operations I am doing; i.e. I am not setting
the local port explicitly:

>         if (me->sockfd = socket( AF_INET, SOCK_STREAM, 0))<0 ) ..
>                 
>         if( (setsockopt(me->sockfd,SOL_SOCKET,SO_REUSEADDR,
>                 ..
>         if (setsockopt(me->sockfd, SOL_SOCKET, SO_SNDBUF,
>                 (const char *) &sndbuf, sizeof(sndbuf)) < 0) {
>                 ...
>         if( (setsockopt(me->sockfd,IPPROTO_TCP,TCP_NODELAY,
>                 (const char *)&one,sizeof(one))) <0) {
>                 ... 
>         bzero( (char *) &server,sizeof(server) );
> 
>         server.sin_family       = AF_INET;
>         server.sin_addr.s_addr  = me->addr;
>         server.sin_port         = htons(me->port);
> 
>         if ((connect( me->sockfd, ( struct sockaddr *) &server, sizeof (server)))<0 ) { 
>	  	...

Now I assume I've ran into some resource limit but I fail to see why.
I've
already  had to increase FD_SETSIZE and play with MSIZE=256 on the
server to get
rid of the 101-254 delay; could that be the mistake; it seems not so to
have made
this problem worse.

But which resource limit, and how do I fix it ?

Any pointers of where to look ?

Thanks !

Dw.
--------------8FBF35BCE937F5FCD1814F39
Content-Type: text/x-vcard; charset=us-ascii;
 name="Dirk.VanGulik.vcf"
Content-Description: Card for Dirk-Willem van Gulik
Content-Disposition: attachment;
 filename="Dirk.VanGulik.vcf"
Content-Transfer-Encoding: 7bit

begin:vcard 
n:van Gulik;Dirk-Willem
tel;fax:+39 0332 78 9185
tel;work:+39 0332 78 9549
x-mozilla-html:FALSE
url:http://me-www.jrc.it/~dirkx
org:Joint Research Center of the European Commission;Software Technology and Applications, Institute for Systems, Informatics and Security
version:2.1
email;internet:Dirk.vanGulik@jrc.it
title:Mr
adr;quoted-printable:;;TP 270 - ISIS/STA=0D=0AJoint Resarch Center;Ispra;VA;21020;Italy
x-mozilla-cpt:;0
fn:Dirk-Willem van Gulik
end:vcard

--------------8FBF35BCE937F5FCD1814F39--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?367664AE.D50A3A75>