From a8c075e732f577cef849ac0b502ab1eefc77d853 Mon Sep 17 00:00:00 2001 From: Edmund Noble Date: Fri, 24 May 2024 19:29:03 -0400 Subject: [PATCH] log: consider HTTP2.ConnectionIsClosed not to be an error condition As hinted in https://github.com/kazu-yamamoto/http2/issues/102, this is not an actual error, but a normal HTTP2 connection terminating. I can trigger this reliably with every `curl` request to my node. Change-Id: Id5984b20a5305ec0af8c5b6c10ab326338520a5f --- chainweb.cabal | 1 + changes/2024-05-30T150038-0400.txt | 1 + src/Chainweb/Chainweb.hs | 5 +++++ 3 files changed, 7 insertions(+) create mode 100644 changes/2024-05-30T150038-0400.txt diff --git a/chainweb.cabal b/chainweb.cabal index 1fa2ac45e1..3eeedd3627 100644 --- a/chainweb.cabal +++ b/chainweb.cabal @@ -394,6 +394,7 @@ library , hashable >= 1.4 , heaps >= 0.3 , hourglass >=0.2 + , http2 >= 5.2.1 , http-client >= 0.5 , http-client-tls >=0.3 , http-media >= 0.7 diff --git a/changes/2024-05-30T150038-0400.txt b/changes/2024-05-30T150038-0400.txt new file mode 100644 index 0000000000..55590e4e37 --- /dev/null +++ b/changes/2024-05-30T150038-0400.txt @@ -0,0 +1 @@ +Stop logging ConnectionIsClosed diff --git a/src/Chainweb/Chainweb.hs b/src/Chainweb/Chainweb.hs index be16a75d7f..683d6f8207 100644 --- a/src/Chainweb/Chainweb.hs +++ b/src/Chainweb/Chainweb.hs @@ -123,6 +123,7 @@ import qualified Data.Vector as V import GHC.Generics import qualified Network.HTTP.Client as HTTP +import qualified Network.HTTP2.Client as HTTP2 import Network.Socket (Socket) import Network.Wai import Network.Wai.Handler.Warp hiding (Port) @@ -785,6 +786,10 @@ runChainweb cw nowServing = do return () | Just ClientClosedConnectionPrematurely <- fromException e = inc clientClosedConnectionsCounter + -- this isn't really an error, this is a graceful close. + -- see https://github.com/kazu-yamamoto/http2/issues/102 + | Just HTTP2.ConnectionIsClosed <- fromException e = + return () | otherwise = when (defaultShouldDisplayException e) $ logg Warn $ loggServerError msg r e