From 489c063cc5f1ef1790f77cd45f1b225af1e9a0f9 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Tue, 19 Nov 2024 14:05:09 +0900 Subject: [PATCH] prevent calling "connClose" twice. TimeManager is leaking because of "BlockedOnMVar". Both TimeManger and Reaper do not use MVar at all. TLS "bye" is the only registered function which uses MVar. When TimeManager kills Warp, "bye" is called twice. One is via "bracket", the other is by TimeManager. This ensures that "bye" is called only once. probably because TLS "bye" is called twice. --- warp/Network/Wai/Handler/Warp/Run.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/warp/Network/Wai/Handler/Warp/Run.hs b/warp/Network/Wai/Handler/Warp/Run.hs index 085960613..98d8a63c9 100644 --- a/warp/Network/Wai/Handler/Warp/Run.hs +++ b/warp/Network/Wai/Handler/Warp/Run.hs @@ -369,7 +369,7 @@ fork set mkConn addr app counter ii = settingsFork set $ \unmask -> do -- above ensures the connection is closed. when goingon $ serveConnection conn ii th addr transport set app where - register = T.registerKillThread (timeoutManager ii) (connClose conn) + register = T.registerKillThread (timeoutManager ii) (return ()) cancel = T.cancel onOpen adr = increase counter >> settingsOnOpen set adr