Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Running out of buffers?



Hi Paul

On 27/04/2018 04:09, Paul Goyette wrote:
I've got lots of memory, so I don't understand what buffers are not
available.  Ever since upgrading to my current system (sources dated
2018-03-20 11:25:00 UTC), I've been seeing these messages at random
intervals:

Can you test the below patches please?
The kernel part bumps the default raw socket buffer from 8k to 16k
At least my ERLITE no longer complains about route socket overflow on boot.

The patch to syslogd ensures that the logpath socket receive buffer is a minimum of 16k - the current default is 4k.

Hopefully this fixes the issues and won't impact small memory devices too much.

Roy
Index: sys/net/raw_cb.h
===================================================================
RCS file: /cvsroot/src/sys/net/raw_cb.h,v
retrieving revision 1.28
diff -u -p -r1.28 raw_cb.h
--- sys/net/raw_cb.h	25 Sep 2017 01:56:22 -0000	1.28
+++ sys/net/raw_cb.h	27 Apr 2018 20:30:55 -0000
@@ -57,7 +57,7 @@ struct rawcb {
  * Nominal space allocated to a raw socket.
  */
 #define	RAWSNDQ		8192
-#define	RAWRCVQ		8192
+#define	RAWRCVQ		16384
 
 LIST_HEAD(rawcbhead, rawcb);
 
Index: usr.sbin/syslogd/syslogd.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.124
diff -u -p -r1.124 syslogd.c
--- usr.sbin/syslogd/syslogd.c	10 Sep 2017 17:01:07 -0000	1.124
+++ usr.sbin/syslogd/syslogd.c	27 Apr 2018 20:30:56 -0000
@@ -75,6 +75,9 @@ __RCSID("$NetBSD: syslogd.c,v 1.124 2017
 #include "syslogd.h"
 #include "extern.h"
 
+/* Minimum size of the logpath socket buffer */
+#define	RCVBUFLEN		16384
+
 #ifndef DISABLE_SIGN
 #include "sign.h"
 struct sign_global_t GlobalSign = {
@@ -480,6 +483,9 @@ getgroup:
 		die(0, 0, NULL);
 	}
 	for (j = 0, pp = LogPaths; *pp; pp++, j++) {
+		int buflen;
+		socklen_t socklen = sizeof(buflen);
+
 		DPRINTF(D_NET, "Making unix dgram socket `%s'\n", *pp);
 		unlink(*pp);
 		memset(&sunx, 0, sizeof(sunx));
@@ -493,6 +499,19 @@ getgroup:
 			die(0, 0, NULL);
 		}
 		DPRINTF(D_NET, "Listening on unix dgram socket `%s'\n", *pp);
+		if (getsockopt(funix[j], SOL_SOCKET, SO_RCVBUF,
+			       &buflen, &socklen) == -1) {
+			logerror("getsockopt: SO_RCVBUF: `%s'", *pp);
+			continue;
+		}
+		if (buflen >= RCVBUFLEN)
+			continue;
+		buflen = RCVBUFLEN;
+		if (setsockopt(funix[j], SOL_SOCKET, SO_RCVBUF,
+			       &buflen, socklen) == -1) {
+			logerror("setsockopt: SO_RCVBUF: `%s'", *pp);
+			continue;
+		}
 	}
 
 	if ((fklog = open(_PATH_KLOG, O_RDONLY, 0)) < 0) {


Home | Main Index | Thread Index | Old Index