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

next in thread | previous in thread | raw e-mail | index | archive | help

--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 <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;
>  		}

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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20161219193606.GQ82166>