Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144557749
D24316.1775454512.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D24316.1775454512.diff
View Options
Index: lib/libc/sys/listen.2
===================================================================
--- lib/libc/sys/listen.2
+++ lib/libc/sys/listen.2
@@ -28,7 +28,7 @@
.\" From: @(#)listen.2 8.2 (Berkeley) 12/11/93
.\" $FreeBSD$
.\"
-.Dd August 18, 2016
+.Dd April 13, 2020
.Dt LISTEN 2
.Os
.Sh NAME
@@ -110,6 +110,13 @@
.Fa backlog
is silently forced to
.Va kern.ipc.soacceptqueue .
+.Pp
+If the listen queue overflows, the kernel will emit a LOG_DEBUG syslog message.
+The
+.Xr sysctl 3
+MIB variable
+.Va kern.ipc.sooverinterval
+specified a per-socket limit on how often the kernel will emit these messages.
.Sh INTERACTION WITH ACCEPT FILTERS
When accept filtering is used on a socket, a second queue will
be used to hold sockets that have connected, but have not yet
Index: sys/kern/uipc_socket.c
===================================================================
--- sys/kern/uipc_socket.c
+++ sys/kern/uipc_socket.c
@@ -571,6 +571,11 @@
®ression_sonewconn_earlytest, 0, "Perform early sonewconn limit test");
#endif
+static timeval overinterval = { 60, 0 };
+SYSCTL_TIMEVAL_SEC(_kern_ipc, OID_AUTO, sooverinterval, CTLFLAG_RW,
+ &overinterval,
+ "Delay in seconds between warnings for listen socket overflows");
+
/*
* When an attempt at a new connection is noted on a socket which accepts
* connections, sonewconn is called. If the connection is possible (subject
@@ -583,34 +588,43 @@
struct socket *
sonewconn(struct socket *head, int connstatus)
{
- static struct timeval lastover;
- static struct timeval overinterval = { 60, 0 };
- static int overcount;
-
struct socket *so;
- u_int over;
+ int overcount;
+ u_int qlen;
+ bool dolog, over;
SOLISTEN_LOCK(head);
over = (head->sol_qlen > 3 * head->sol_qlimit / 2);
- SOLISTEN_UNLOCK(head);
#ifdef REGRESSION
if (regression_sonewconn_earlytest && over) {
#else
if (over) {
#endif
- overcount++;
+ head->sol_overcount++;
+ dolog = !!ratecheck(&head->sol_lastover, &overinterval);
- if (ratecheck(&lastover, &overinterval)) {
+ /*
+ * If we're going to log, copy the overflow count and queue
+ * length from the listen socket before dropping the lock.
+ * Also, reset the overflow count.
+ */
+ if (dolog) {
+ overcount = head->sol_overcount;
+ head->sol_overcount = 0;
+ qlen = head->sol_qlen;
+ }
+ SOLISTEN_UNLOCK(head);
+
+ if (dolog) {
log(LOG_DEBUG, "%s: pcb %p: Listen queue overflow: "
"%i already in queue awaiting acceptance "
"(%d occurrences)\n",
- __func__, head->so_pcb, head->sol_qlen, overcount);
-
- overcount = 0;
+ __func__, head->so_pcb, qlen, overcount);
}
return (NULL);
}
+ SOLISTEN_UNLOCK(head);
VNET_ASSERT(head->so_vnet != NULL, ("%s: so %p vnet is NULL",
__func__, head));
so = soalloc(head->so_vnet);
Index: sys/sys/socketvar.h
===================================================================
--- sys/sys/socketvar.h
+++ sys/sys/socketvar.h
@@ -172,6 +172,10 @@
short sol_sbsnd_flags;
sbintime_t sol_sbrcv_timeo;
sbintime_t sol_sbsnd_timeo;
+
+ /* Information tracking listen queue overflows. */
+ struct timeval sol_lastover; /* (e) */
+ int sol_overcount; /* (e) */
};
};
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 6, 5:48 AM (3 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28271305
Default Alt Text
D24316.1775454512.diff (3 KB)
Attached To
Mode
D24316: Make sonewconn overflow messages have per-socket rate-limits and values
Attached
Detach File
Event Timeline
Log In to Comment