From 987fcfd3f24cacb4c07bdef8c4cde09f03991796 Mon Sep 17 00:00:00 2001 From: Edsko de Vries Date: Tue, 17 Dec 2024 16:13:37 +0100 Subject: [PATCH] Disable WAI timeouts altogether Depends on https://github.com/yesodweb/wai/pull/1017 Closes https://github.com/well-typed/grapesy/issues/123 --- .github/workflows/haskell-ci.yml | 6 ++++ cabal.project | 6 ++++ cabal.project.ci | 6 ++++ .../src/Network/GRPC/Common/Compression.hs | 2 -- grapesy/src/Network/GRPC/Util/HTTP2.hs | 29 +++---------------- 5 files changed, 22 insertions(+), 27 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index e4590aba..afcd92b2 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -228,6 +228,12 @@ jobs: echo "package trailers-only-tutorial" >> cabal.project echo " ghc-options: -Werror=missing-methods" >> cabal.project cat >> cabal.project < IO a) -> IO a withTimeManager = TimeManager.withManager (disableTimeout * 1_000_000) --- | Work around the fact that we cannot disable timeouts in http2/http2-tls +-- | Disable timeouts in http2/http2-tls -- --- TODO: --- We need a proper solution for this. +-- A value of 0 (or lower) disables timeouts altogether as of +-- . disableTimeout :: Int -disableTimeout = -#if (WORD_SIZE_IN_BITS == 64) - -- Set a really high timeout to effectively disable timeouts (100 years) - -- - -- NOTE: We cannot use 'maxBound' here, because this value is multiplied - -- by @1_000_000@ in 'Network.Run.TCP.Timeout.runTCPServerWithSocket' - -- (in @network-run@). - 100 * 365 * 24 * 60 * 60 -#else -#warning "Timeout for RPC messages is set to 30 minutes on 32-bit systems." -#warning "See https://github.com/kazu-yamamoto/http2/issues/112" - -- Unfortunately, the same trick does not work on 32-bit systems, where we - -- simply don't have enough range. The maximum timeout we can support here - -- is roughly 35 mins. We set it to 30 minutes exactly, to at least provide - -- a clue if the timeout does hit (1_800_000_000 < 2_147_483_647). - 30 * 60 -#endif - +disableTimeout = 0