From owner-freebsd-net@FreeBSD.ORG Fri Mar 7 06:23:52 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3B4EA2FE for ; Fri, 7 Mar 2014 06:23:52 +0000 (UTC) Received: from mail-ee0-x22d.google.com (mail-ee0-x22d.google.com [IPv6:2a00:1450:4013:c00::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CB3C6AF for ; Fri, 7 Mar 2014 06:23:51 +0000 (UTC) Received: by mail-ee0-f45.google.com with SMTP id d17so1516907eek.32 for ; Thu, 06 Mar 2014 22:23:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=6GjPKbtrw2EloCoFgG9WSv/0doF88lvBm/r383rJZeU=; b=eu6NKOSVQUtOR4tQkx/+M3JHscHBVD0hRjhs2Dytsvrwt/gjv2ylzLtCe5hr0IfrLo Ulr1CRbIlpTk8f7RJhKIwubCNz65/Hd++ZyEoc8bN1TrLCS8aLUHKylHBnfoY4yOy0wi dxBSuNQWH5yme9oPGYWhZqajTIV0+VJnTMrSo/YfEX234LGc4GAodw03zUqHgi3x7uUc unVP3plDPQpbqoJWO9Iwcx9xp6EPVvt1/JYs7qlmd0x4bIdR1sws4Fj8QmX22XzN90I+ AYXPgpbY8FBQxto9uOdIFQU8b3w82mEGd5UU4Vc31GAPkrtPii49cYT16XGCPapt+8Hp MpoQ== MIME-Version: 1.0 X-Received: by 10.14.39.3 with SMTP id c3mr16949577eeb.42.1394173430111; Thu, 06 Mar 2014 22:23:50 -0800 (PST) Received: by 10.14.65.4 with HTTP; Thu, 6 Mar 2014 22:23:50 -0800 (PST) Date: Thu, 6 Mar 2014 22:23:50 -0800 Message-ID: Subject: Include port number in "Listen queue overflow" messages From: hiren panchasara To: "freebsd-net@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Mar 2014 06:23:52 -0000 I am thinking of committing following change that includes port number in "Listen queue overflow" messages. 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 #include #include +#include #include @@ -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; }