Include port number in "Listen queue overflow" messages
Navdeep Parhar
nparhar at gmail.com
Wed Mar 19 16:35:48 UTC 2014
On Tue, Mar 18, 2014 at 11:05:23PM -0700, Julian Elischer wrote:
> On 3/18/14, 8:33 PM, George Neville-Neil wrote:
> >On Mar 7, 2014, at 1:23 , hiren panchasara <hiren.panchasara at gmail.com> wrote:
> >
> >>I am thinking of committing following change that includes port number
> >>in "Listen queue overflow" messages.
> I think it's a good idea. There is even more information available
> but this is probably enough.
> >>
> >I like it.
> >
> >Best,
> >George
> >
I think the suggested change isn't correct as is assumes every socket's pcb is
an inpcb.
Navdeep
> >>New message would look something like:
> >>sonewconn: pcb 0xfffff8001b155760: Listen queue overflow on port
> >>13120: 1 already in queue awaiting acceptance (454 occurrences)
> >>
> >>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.
> >>
> >>IMO, this change will make debugging easier.
> >>
> >>cheers,
> >>Hiren
> >>
> >>Index: sys/kern/uipc_socket.c
> >>===================================================================
> >>--- 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>
> >>
> >>#include <net/vnet.h>
> >>
> >>@@ -491,8 +492,11 @@
> >> static int overcount;
> >>
> >> struct socket *so;
> >>+ struct inpcb *inp;
> >> int over;
> >>
> >>+ inp = sotoinpcb(head);
> >>+
> >> ACCEPT_LOCK();
> >> over = (head->so_qlen > 3 * head->so_qlimit / 2);
> >> ACCEPT_UNLOCK();
> >>@@ -504,10 +508,12 @@
> >> overcount++;
> >>
> >> 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);
> >>
> >> overcount = 0;
> >> }
> >>_______________________________________________
> >>freebsd-net at freebsd.org mailing list
> >>http://lists.freebsd.org/mailman/listinfo/freebsd-net
> >>To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
> >_______________________________________________
> >freebsd-net at freebsd.org mailing list
> >http://lists.freebsd.org/mailman/listinfo/freebsd-net
> >To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
> >
>
> _______________________________________________
> freebsd-net at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
More information about the freebsd-net
mailing list