Date: Sat, 26 Jan 2002 10:55:03 -0800 (PST) From: Boyan Gadjev <bgadjev@verio.net> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/34307: accept() fails after ECONNABORTED Message-ID: <200201261855.g0QIt3K19871@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 34307 >Category: misc >Synopsis: accept() fails after ECONNABORTED >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jan 26 11:00:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Boyan Gadjev >Release: 4.5-RC >Organization: NTT/Verio >Environment: FreeBSD mail01a.rapidsite.net 4.5-RC FreeBSD 4.5-RC #0: Tue Jan 22 17:20:15 EST 2002 root@freebsd.boca.verio.net:/usr/src/sys/compile/VERIO i386 >Description: s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) sockopt = 1; sockoptlen = 4; setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&sockopt, sockoptlen); sockopt = 1; sockoptlen = 4; setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (char *)&sockopt, sockoptlen); bind() ; listen(s,200) /* i have kern.ipc.somaxconn = 256 */ while(1) { confd = accept (s, (struct sockaddr *) &server, &sockaddr_len); if (confd < 0) { myerrno = errno; if ((myerrno != EWOULDBLOCK) && (myerrno != EAGAIN)) break; else { continue; } ............. ................. } } And here is the problem. If I ignore ECONNABORTED like I do for EAGAIN and EWOULDBLOCK then every accept() after that would NOT change 'server' meaning that I am not able to get the remote address. I have to actually close and recreate the socket before I use accept() again. I tried non-blocking and blocking socket and the result is the same. Load on the box gets betw4een 4-7 and I have thousands connections per second to that port. >How-To-Repeat: Create a small program that listens on a port and hit the port with many connections (connect write close) till you get ECONNABORTED on the server side. >Fix: the only one i thought of was to recreate the socket after ECONNABORTED. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201261855.g0QIt3K19871>