Skip to contentSkip to conversation

tabled: suppress repeating messages

PATCH Applied Pete Zaitcev 2 participants 2 messages Jan 15, 2010 – Jan 20, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 5/7 tabled: suppress repeating messages

Every time CLD crashes, I find my logs filled up with error messages. But running without them is no good either, so I don't want to remove this message entirely. Let us try some filtering.

Actually, I am still considering if we should not reset the error to zero whenever a packet is recived successfuly, but this seems to work well in practice.

---
 server/cldu.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

commit 1c2d867711e4fe62d2ba4dd2f334e0e44a8ff7fa

Author: Master <[email protected]>
Date:   Thu Jan 14 19:57:43 2010 -0700

Filter error messages from UDP receives.

server/cldu.c +11 -1
index 1d61672..9cda87e 100644
@@ -53,6 +53,7 @@ struct cld_session {
 	struct cldc_udp *lib;		/* library state */
 	struct event lib_timer;
 	int retry_cnt;
+	int last_recv_err;
 
 	/*
 	 * For code sanity and being isomorphic with conventional programming
@@ -226,7 +227,16 @@ static void cldu_event(int fd, short events, void *userdata)
 
 	rc = cldc_udp_receive_pkt(sp->lib);
 	if (rc) {
-		applog(LOG_INFO, "cldc_udp_receive_pkt failed: %d", rc);
+		if (rc != sp->last_recv_err) {
+			if (rc < -1000)		/* our internal code */
+				applog(LOG_INFO,
+				       "cldc_udp_receive_pkt failed: %d", rc);
+			else
+				applog(LOG_INFO,
+				       "cldc_udp_receive_pkt failed: %s",
+				       strerror(-rc));
+			sp->last_recv_err = rc;
+		}
 		/*
 		 * Reacting to ICMP messages is a bad idea, because
 		 *  - it makes us loop hard in case CLD is down, unless we
#1 lore raw
Quoted 8 lines · Pete Zaitcev

Every time CLD crashes, I find my logs filled up with error messages. But running without them is no good either, so I don't want to remove this message entirely. Let us try some filtering.

Actually, I am still considering if we should not reset the error to zero whenever a packet is recived successfuly, but this seems to work well in practice.

Quoted 5 lines
---
  server/cldu.c |   12 +++++++++++-
  1 file changed, 11 insertions(+), 1 deletion(-)

applied 5-7