From owner-freebsd-hackers Tue Dec 15 05:34:03 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id FAA28468 for freebsd-hackers-outgoing; Tue, 15 Dec 1998 05:34:03 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from mrelay.jrc.it (mrelay.jrc.it [139.191.1.65]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id FAA28408 for ; Tue, 15 Dec 1998 05:33:59 -0800 (PST) (envelope-from dirk.vangulik@jrc.it) Received: from jrc.it (elpc51.jrc.it [139.191.71.51]) by mrelay.jrc.it (LMC5692) with ESMTP id OAA05625; Tue, 15 Dec 1998 14:34:30 +0100 (MET) Message-ID: <367664AE.D50A3A75@jrc.it> Date: Tue, 15 Dec 1998 14:31:26 +0100 From: Dirk-Willem van Gulik Organization: ISIS/STA - Joint Research Center of the European Commission X-Mailer: Mozilla 4.5 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: freebsd-hackers@FreeBSD.ORG, Dirk-Willem van Gulik Subject: EADDRINUSE rather than EADDRNOTAVAIL Content-Type: multipart/mixed; boundary="------------8FBF35BCE937F5FCD1814F39" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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