From 5f843532666d0c46784563e66e04b8a4f68711ab 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 --- grapesy/grapesy.cabal | 2 +- .../src/Network/GRPC/Common/Compression.hs | 2 -- grapesy/src/Network/GRPC/Util/HTTP2.hs | 28 ++----------------- 3 files changed, 4 insertions(+), 28 deletions(-) diff --git a/grapesy/grapesy.cabal b/grapesy/grapesy.cabal index 3f406ddd..514155d5 100644 --- a/grapesy/grapesy.cabal +++ b/grapesy/grapesy.cabal @@ -166,7 +166,7 @@ library , recv >= 0.1 && < 0.2 , stm >= 2.5 && < 2.6 , text >= 1.2 && < 2.2 - , time-manager >= 0.2.1 && < 0.3 + , time-manager >= 0.2.2 && < 0.3 , tls >= 1.7 && < 2.2 , unbounded-delays >= 0.1.1 && < 0.2 , unordered-containers >= 0.2 && < 0.3 diff --git a/grapesy/src/Network/GRPC/Common/Compression.hs b/grapesy/src/Network/GRPC/Common/Compression.hs index ac38c4f0..5ffccf11 100644 --- a/grapesy/src/Network/GRPC/Common/Compression.hs +++ b/grapesy/src/Network/GRPC/Common/Compression.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE CPP #-} - -- | Public 'Compression' API -- -- Intended for qualified import. diff --git a/grapesy/src/Network/GRPC/Util/HTTP2.hs b/grapesy/src/Network/GRPC/Util/HTTP2.hs index ef00c75d..6a58785c 100644 --- a/grapesy/src/Network/GRPC/Util/HTTP2.hs +++ b/grapesy/src/Network/GRPC/Util/HTTP2.hs @@ -1,7 +1,3 @@ -{-# LANGUAGE CPP #-} - -#include "MachDeps.h" - module Network.GRPC.Util.HTTP2 ( -- * General auxiliary fromHeaderTable @@ -219,26 +215,8 @@ mkTlsSettings http2Settings keyLogger = withTimeManager :: (Time.Manager -> 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 as of @time-manager-0.2.2@. 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