From fc3d4e4c2fb527954780ba958659e70f35fffe6c Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 27 May 2021 10:49:37 -0400 Subject: Upgrade and rate-limit compression failure message. Without this message getting logged at 'WARN', it's hard to contextualize the messages we get about compression bombs, so this message should fix #40175. I'm rate-limiting this, however, since it _could_ get spammy if somebody on the network starts acting up. (Right now it should be very quiet; I've asked Sebastian to check it, and he says that he doesn't hit this message in practice.) Closes #40175. --- src/feature/dirclient/dirclient.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/feature/dirclient/dirclient.c b/src/feature/dirclient/dirclient.c index a5dd856729..b589e829f9 100644 --- a/src/feature/dirclient/dirclient.c +++ b/src/feature/dirclient/dirclient.c @@ -1944,7 +1944,9 @@ dir_client_decompress_response_body(char **bodyp, size_t *bodylenp, /* If we're pretty sure that we have a compressed directory, and * we didn't manage to uncompress it, then warn and bail. */ if (!plausible && !new_body) { - log_fn(LOG_PROTOCOL_WARN, LD_HTTP, + const int LOG_INTERVAL = 3600; + static ratelim_t warning_limit = RATELIM_INIT(LOG_INTERVAL); + log_fn_ratelim(&warning_limit, LOG_WARN, LD_HTTP, "Unable to decompress HTTP body (tried %s%s%s, on %s).", description1, tried_both?" and ":"", -- cgit v1.2.3-54-g00ecf From 9348b1b440ad17b3a5dda52b5389bbaf6f23ed56 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 1 Jun 2021 12:16:06 -0400 Subject: changes file for #40175 --- changes/bug40175 | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changes/bug40175 diff --git a/changes/bug40175 b/changes/bug40175 new file mode 100644 index 0000000000..aa2ce9566f --- /dev/null +++ b/changes/bug40175 @@ -0,0 +1,5 @@ + o Minor features (logging, diagnostic): + - Log decompression failures at a higher severity level, since they + can help provide missing context for other warning messages. + We rate-limit these messages, to avoid flooding the logs if they + begin to occur frequently. Closes ticket 40175. -- cgit v1.2.3-54-g00ecf