From owner-freebsd-stable@freebsd.org Fri Dec 16 08:21:36 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 79176C82782; Fri, 16 Dec 2016 08:21:36 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward2j.cmail.yandex.net (forward2j.cmail.yandex.net [IPv6:2a02:6b8:0:1630::15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0D8C437E; Fri, 16 Dec 2016 08:21:35 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [77.88.29.86]) by forward2j.cmail.yandex.net (Yandex) with ESMTP id 59302212B5; Fri, 16 Dec 2016 11:21:32 +0300 (MSK) Received: from smtp3p.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp3p.mail.yandex.net (Yandex) with ESMTP id 9C27C1320264; Fri, 16 Dec 2016 11:21:29 +0300 (MSK) Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id fxPaBgd7bp-LSra8Y7O; Fri, 16 Dec 2016 11:21:28 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1481876488; bh=rueidvQP+8RqNOGn14hZdDX6T2JnSFYKbRgQCugHgWY=; h=Subject:To:References:Cc:From:Message-ID:Date:In-Reply-To; b=iYhP1a+y5YUAkQ9b9BlZE4Otsp+3M1VhtB/6+W+k/WKSk8Hjh6sjwOtDBOcxyHWtC RMl+B1LUvSxAfitgbkOsWdETDiGxLndwwDCbuckiO0FAAY9n/ABVjU8iXH1WJI1ckw Z8WFnamIX/AONiUtnXckgkmwWIC//ajdXGCoEmy4= Authentication-Results: smtp3p.mail.yandex.net; dkim=pass header.i=@yandex.ru X-Yandex-Suid-Status: 1 0,1 0,1 0,1 0 Subject: Re: sonewconn: pcb [...]: Listen queue overflow to human-readable form To: hiren panchasara , "Eugene M. Zheganin" References: <58528B50.8030600@norma.perm.ru> <20161215175141.GE82166@strugglingcoder.info> Cc: freebsd-net , freebsd-stable@freebsd.org From: "Andrey V. Elsukov" Message-ID: <010586a3-0d44-7f83-32f1-d3ad79788fad@yandex.ru> Date: Fri, 16 Dec 2016 11:20:43 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161215175141.GE82166@strugglingcoder.info> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XMO3HW3IWVKvmWovhMWUWW1eVUF2IdRle" 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: Fri, 16 Dec 2016 08:21:36 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --XMO3HW3IWVKvmWovhMWUWW1eVUF2IdRle Content-Type: multipart/mixed; boundary="0VRL1P2tmBNH52pvVl1ETgK3cICBVqO7I"; protected-headers="v1" From: "Andrey V. Elsukov" To: hiren panchasara , "Eugene M. Zheganin" Cc: freebsd-net , freebsd-stable@freebsd.org Message-ID: <010586a3-0d44-7f83-32f1-d3ad79788fad@yandex.ru> Subject: Re: sonewconn: pcb [...]: Listen queue overflow to human-readable form References: <58528B50.8030600@norma.perm.ru> <20161215175141.GE82166@strugglingcoder.info> In-Reply-To: <20161215175141.GE82166@strugglingcoder.info> --0VRL1P2tmBNH52pvVl1ETgK3cICBVqO7I Content-Type: multipart/mixed; boundary="------------6F38ED10A3D2AFFC6EB7E045" This is a multi-part message in MIME format. --------------6F38ED10A3D2AFFC6EB7E045 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 i= n >> 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 thi= s >> 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 Hi Hiren, I think the check for socket's domain should be enough? --=20 WBR, Andrey V. Elsukov --------------6F38ED10A3D2AFFC6EB7E045 Content-Type: text/x-patch; name="uipc_socket.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="uipc_socket.diff" 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; } --------------6F38ED10A3D2AFFC6EB7E045-- --0VRL1P2tmBNH52pvVl1ETgK3cICBVqO7I-- --XMO3HW3IWVKvmWovhMWUWW1eVUF2IdRle Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEvBAEBCAAZBQJYU6PbEhxidTdjaGVyQHlhbmRleC5ydQAKCRABxeoEEMihemoH CACza54G8ZOh5wemtv3ETfDYHsDFiodrwsnoN7NOpF1AHz7Sqzm/a+wspXYPzOtW k4tT8bBTYidmCw0RzM3+Ee7S6KmwHw589B1ZmFi8Zaz21A3pKYuZG63w+LAckWHI x+zILL4vQ2Hcv4krrqfmPxo9+ZVSrfGJEkTS1X6bojYAHY+nQOylTzBoaGJZ0QRs 4s1txOXfzqpmQQ15FOEN/ZzPri411PM7W9k+cr6lPc0+z+gjg4NyeWZyyNPVkPK6 J1+soGmJb2eEZIb/WsxQcKn7j25nKAwPFtVUhzQVtvAnPLOcb6FO0YHm8KrAatnz r61qVePT6hNz3VMYHBN4jxA3 =ni2y -----END PGP SIGNATURE----- --XMO3HW3IWVKvmWovhMWUWW1eVUF2IdRle--