Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Dec 2016 11:20:43 +0300
From:      "Andrey V. Elsukov" <bu7cher@yandex.ru>
To:        hiren panchasara <hiren@strugglingcoder.info>, "Eugene M. Zheganin" <emz@norma.perm.ru>
Cc:        freebsd-net <freebsd-net@freebsd.org>, freebsd-stable@freebsd.org
Subject:   Re: sonewconn: pcb [...]: Listen queue overflow to human-readable form
Message-ID:  <010586a3-0d44-7f83-32f1-d3ad79788fad@yandex.ru>
In-Reply-To: <20161215175141.GE82166@strugglingcoder.info>
References:  <58528B50.8030600@norma.perm.ru> <20161215175141.GE82166@strugglingcoder.info>

next in thread | previous in thread | raw e-mail | index | archive | help
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" <bu7cher@yandex.ru>
To: hiren panchasara <hiren@strugglingcoder.info>,
 "Eugene M. Zheganin" <emz@norma.perm.ru>
Cc: freebsd-net <freebsd-net@freebsd.org>, 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 <sys/jail.h>
 #include <sys/syslog.h>
 #include <netinet/in.h>
+#include <netinet/in_pcb.h>
=20
 #include <net/vnet.h>
=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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?010586a3-0d44-7f83-32f1-d3ad79788fad>