Skip to content

Commit

Permalink
prevent calling "connClose" twice.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kazu-yamamoto committed Nov 19, 2024
1 parent a385430 commit 489c063
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion warp/Network/Wai/Handler/Warp/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 489c063

Please sign in to comment.