[nsd-users] error: failed reading from tcp: Connection reset by peer

Shane Kerr shane at ca.afilias.info
Fri May 16 08:31:15 UTC 2008


All,

I see the following message fairly frequently in our nsd.log files:

error: failed reading from tcp: Connection reset by peer

A quick grep through the source code reveals that this log message comes
from server.c, and can come pretty much at any time during a TCP query.

Since:

- This condition occurs during normal operation, and 
- There is nothing a server operator can do about it.

I suggest that it should not be in the logs. All it does is make server
operators confused and nervous (at least, it made me confused and
nervous when I saw these messages).

I've included a very short patch to NSD that seems to do the trick.

--
Shane

--- server.c.orig	2008-05-16 10:20:25.000000000 +0200
+++ server.c	2008-05-16 10:21:44.000000000 +0200
@@ -1394,7 +1394,9 @@
 				 */
 				return;
 			} else {
-				log_msg(LOG_ERR, "failed reading from tcp: %s", strerror(errno));
+				if (errno != ECONNRESET) {
+					log_msg(LOG_ERR, "failed reading from tcp: %s", strerror(errno));
+				}
 				cleanup_tcp_handler(netio, handler);
 				return;
 			}
@@ -1454,7 +1456,9 @@
 			 */
 			return;
 		} else {
-			log_msg(LOG_ERR, "failed reading from tcp: %s", strerror(errno));
+			if (errno != ECONNRESET) {
+				log_msg(LOG_ERR, "failed reading from tcp: %s", strerror(errno));
+			}
 			cleanup_tcp_handler(netio, handler);
 			return;
 		}





More information about the nsd-users mailing list