svn commit: r257472 - head/sys/kern

Maksim Yevmenkin emax at FreeBSD.org
Thu Oct 31 20:33:22 UTC 2013


Author: emax
Date: Thu Oct 31 20:33:21 2013
New Revision: 257472
URL: http://svnweb.freebsd.org/changeset/base/257472

Log:
  Rate limit (to once per minute) "Listen queue overflow" message in
  sonewconn().
  
  Reviewed by:	scottl, lstewart
  Obtained from:	Netflix, Inc
  MFC after:	2 weeks

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c	Thu Oct 31 20:32:11 2013	(r257471)
+++ head/sys/kern/uipc_socket.c	Thu Oct 31 20:33:21 2013	(r257472)
@@ -486,6 +486,10 @@ SYSCTL_INT(_regression, OID_AUTO, sonewc
 struct socket *
 sonewconn(struct socket *head, int connstatus)
 {
+	static struct timeval lastover;
+	static struct timeval overinterval = { 60, 0 };
+	static int overcount;
+
 	struct socket *so;
 	int over;
 
@@ -497,9 +501,17 @@ sonewconn(struct socket *head, int conns
 #else
 	if (over) {
 #endif
-		log(LOG_DEBUG, "%s: pcb %p: Listen queue overflow: "
-		    "%i already in queue awaiting acceptance\n",
-		    __func__, head->so_pcb, head->so_qlen);
+		overcount++;
+
+		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);
+
+			overcount = 0;
+		}
+
 		return (NULL);
 	}
 	VNET_ASSERT(head->so_vnet != NULL, ("%s:%d so_vnet is NULL, head=%p",


More information about the svn-src-head mailing list