From owner-freebsd-stable@freebsd.org Mon Dec 19 19:36:07 2016 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C045AC872AA; Mon, 19 Dec 2016 19:36:07 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from mail.strugglingcoder.info (strugglingcoder.info [104.236.146.68]) by mx1.freebsd.org (Postfix) with ESMTP id A3C8E12BE; Mon, 19 Dec 2016 19:36:07 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from localhost (unknown [10.1.1.3]) (Authenticated sender: hiren@strugglingcoder.info) by mail.strugglingcoder.info (Postfix) with ESMTPA id C6982178B2; Mon, 19 Dec 2016 11:36:06 -0800 (PST) Date: Mon, 19 Dec 2016 11:36:06 -0800 From: hiren panchasara To: "Andrey V. Elsukov" Cc: "Eugene M. Zheganin" , freebsd-net , freebsd-stable@freebsd.org Subject: Re: sonewconn: pcb [...]: Listen queue overflow to human-readable form Message-ID: <20161219193606.GQ82166@strugglingcoder.info> References: <58528B50.8030600@norma.perm.ru> <20161215175141.GE82166@strugglingcoder.info> <010586a3-0d44-7f83-32f1-d3ad79788fad@yandex.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="XQ/JOjNzrAcf1KaA" Content-Disposition: inline In-Reply-To: <010586a3-0d44-7f83-32f1-d3ad79788fad@yandex.ru> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 19:36:07 -0000 --XQ/JOjNzrAcf1KaA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 12/16/16 at 11:20P, Andrey V. Elsukov wrote: > On 15.12.2016 20:51, hiren panchasara wrote: > > On 12/15/16 at 05:23P, Eugene M. Zheganin wrote: > >> Hi. > >> > >> Sometimes on one of my servers I got dmesg full of > >> > >> sonewconn: pcb 0xfffff80373aec000: Listen queue overflow: 49 already in > >> queue awaiting acceptance (6 occurrences) > > [skip] > >> > >> but at the time of investigation the socket is already closed and lsof > >> cannot show me the owner. I wonder if the kernel can itself decode this > >> output and write it in the human-readable form ? > >=20 > > I have this not-quite-correct patch that may help you. (If you follow t= he > > discussion there, you'd know why its not complete.)=20 > >=20 > > https://lists.freebsd.org/pipermail/freebsd-net/2014-March/038074.html >=20 > Hi Hiren, >=20 > I think the check for socket's domain should be enough? >=20 >=20 > --=20 > WBR, Andrey V. Elsukov > Index: sys/kern/uipc_socket.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/kern/uipc_socket.c (revision 309834) > +++ sys/kern/uipc_socket.c (working copy) > @@ -139,6 +139,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > =20 > #include > =20 > @@ -577,10 +578,15 @@ sonewconn(struct socket *head, int connstatus) > overcount++; > =20 > if (ratecheck(&lastover, &overinterval)) { > - log(LOG_DEBUG, "%s: pcb %p: Listen queue overflow: " > - "%i already in queue awaiting acceptance " > - "(%d occurrences)\n", > - __func__, head->so_pcb, head->so_qlen, overcount); > + if (INP_CHECK_SOCKAF(head, AF_INET) || > + INP_CHECK_SOCKAF(head, AF_INET6)) > + over =3D ntohs(sotoinpcb(head)->inp_lport); > + else > + over =3D 0; > + log(LOG_DEBUG, "%s: pcb %p: Listen queue overflow on " > + "port %d: %i already in queue awaiting acceptance " > + "(%d occurrences)\n", __func__, head->so_pcb, > + over, head->so_qlen, overcount); > =20 > overcount =3D 0; > } Andrey, Thanks, this seems correct to me. :-) Cheers, Hiren --XQ/JOjNzrAcf1KaA Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAABCgBmBQJYWDajXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4 QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/l8w8H/RpSEXSdSJUazfH2Hl+NaqHv 2dtgPLQkRnwz3+XvosDLEJdNRzqMXGdTKm/Vs9NvC5KjERCp3JgmmkGFRTjBx1BE ABe8K7Io2cEhlXeDrDVoKrs8o7x94XYarGb2EcVyR0IPoX1Io5BGn+lGmNa+Sczk xEaMZryNx+B+EyehiBZnVxksdVQkqMNyBtgL5aTENBhArqC5Pcya4m9jqiHg1r+4 oQTC/e4AsrZhU3CaOH6NcurrAPMFVm/9O30g3zpVuFUqXf90kuss7EhBv5lva+wy chsmJhq4+A0uWgE7rDVUWAEhYIPwl7kbmAnSTPftMqohH6jYu4ebVaoqTPHCvkg= =Zwm9 -----END PGP SIGNATURE----- --XQ/JOjNzrAcf1KaA--