on master help sign in
Do not special-handle ResourceExhausted

There is no guarantee that running out of file-descriptors is a temporary condition, and simply sleeping for a second is a naive solution. In the general case, it is better to scream loudly and alert an administrator to this case.

commit3011cade3b7a6eb9dab124b1f6f6c4fc15efa121 authorReid Draper <reiddraper@gmail.com> dateWed 18 May 2016, 10:42 (10 years ago) parent7eded08
1 file changed+2−12
warp/Network/Wai/Handler/Warp/Run.hs+2−12
warp/Network/Wai/Handler/Warp/Run.hs+2−12
@@ -13,7 +13,6 @@ module Network.Wai.Handler.Warp.Run where
1313import Control.Applicative ((<$>))
1414#endif
1515import Control.Arrow (first)
16−import Control.Concurrent (threadDelay)
1716import qualified Control.Concurrent as Conc (yield)
1817import Control.Exception as E
1918import Control.Monad (when, unless, void)
@@ -44,7 +43,6 @@ import qualified Network.Wai.Handler.Warp.Timeout as T
4443import Network.Wai.Handler.Warp.Types
4544import Network.Wai.Internal (ResponseReceived (ResponseReceived))
4645import System.Environment (getEnvironment)
47−import System.IO.Error (isFullErrorType, ioeGetErrorType)
4846
4947#if WINDOWS
5048import Network.Wai.Handler.Warp.Windows
@@ -242,17 +240,9 @@ acceptConnection set getConnMaker app counter ii0 = do
242240 ex <- try getConnMaker
243241 case ex of
244242 Right x -> return $ Just x
245− Left e -> do
243+ Left (e :: IOError) -> do
246244 settingsOnException set Nothing $ toException e
247− if isFullErrorType (ioeGetErrorType e) then do
248− -- "resource exhausted (Too many open files)" may
249− -- happen by accept(). Wait a second hoping that
250− -- resource will be available.
251− threadDelay 1000000
252− acceptNewConnection
253− else
254− -- Assuming the listen socket is closed.
255− return Nothing
245+ return Nothing
256246
257247-- Fork a new worker thread for this connection maker, and ask for a
258248-- function to unmask (i.e., allow async exceptions to be thrown).