Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Mar 2014 23:33:23 -0400
From:      George Neville-Neil <gnn@neville-neil.com>
To:        hiren panchasara <hiren.panchasara@gmail.com>
Cc:        "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
Subject:   Re: Include port number in "Listen queue overflow" messages
Message-ID:  <EC50E026-4DB3-46FA-A931-A1892923967F@neville-neil.com>
In-Reply-To: <CALCpEUHHxKE2P=i92eZrFSe-cX5%2BrpQLcD%2BbGfksb8hHP4WPag@mail.gmail.com>
References:  <CALCpEUHHxKE2P=i92eZrFSe-cX5%2BrpQLcD%2BbGfksb8hHP4WPag@mail.gmail.com>

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

On Mar 7, 2014, at 1:23 , hiren panchasara <hiren.panchasara@gmail.com> =
wrote:

> I am thinking of committing following change that includes port number
> in "Listen queue overflow" messages.
>=20

I like it.

Best,
George

> New message would look something like:
> sonewconn: pcb 0xfffff8001b155760: Listen queue overflow on port
> 13120: 1 already in queue awaiting acceptance (454 occurrences)
>=20
> I've recently ran into a situation at $work where I could not catch
> the culprit application via "netstat -A" and had to dive into kgdb to
> find the port from pcb where this application was listening to.
>=20
> IMO, this change will make debugging easier.
>=20
> cheers,
> Hiren
>=20
> 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 262861)
> +++ sys/kern/uipc_socket.c      (working copy)
> @@ -136,6 +136,7 @@
> #include <sys/jail.h>
> #include <sys/syslog.h>
> #include <netinet/in.h>
> +#include <netinet/in_pcb.h>
>=20
> #include <net/vnet.h>
>=20
> @@ -491,8 +492,11 @@
>        static int overcount;
>=20
>        struct socket *so;
> +       struct inpcb *inp;
>        int over;
>=20
> +       inp =3D sotoinpcb(head);
> +
>        ACCEPT_LOCK();
>        over =3D (head->so_qlen > 3 * head->so_qlimit / 2);
>        ACCEPT_UNLOCK();
> @@ -504,10 +508,12 @@
>                overcount++;
>=20
>                if (ratecheck(&lastover, &overinterval)) {
> -                       log(LOG_DEBUG, "%s: pcb %p: Listen queue =
overflow: "
> -                           "%i already in queue awaiting acceptance "
> +                       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, head->so_qlen, =
overcount);
> +                           __func__, head->so_pcb,
> +                           ntohs(inp->inp_inc.inc_lport), =
head->so_qlen,
> +                           overcount);
>=20
>                        overcount =3D 0;
>                }
> _______________________________________________
> freebsd-net@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?EC50E026-4DB3-46FA-A931-A1892923967F>