Skip to content

Commit

Permalink
log: consider HTTP2.ConnectionIsClosed not to be an error condition
Browse files Browse the repository at this point in the history
As hinted in kazu-yamamoto/http2#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
  • Loading branch information
edmundnoble committed May 27, 2024
1 parent ce830f9 commit ae0e37f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Unreleased (2024-XX-YY)

Changes:

- Stop logging ConnectionIsClosed (#xxxx)

Internal Changes:
- Unify HTTP error logging across service and P2P APIs (#xxxx)
Expand Down
1 change: 1 addition & 0 deletions chainweb.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/Chainweb/Chainweb.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -784,6 +785,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
Expand Down

0 comments on commit ae0e37f

Please sign in to comment.