Commit efc2614e authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Clean up pipes early on failed forks that we do not accumulate open file descriptors.
Signed-off-by: default avatarKlaus Aehlig <>
Reviewed-by: default avatarPetr Pudlak <>
parent 9ef7013e
......@@ -62,6 +62,7 @@ module Ganeti.Query.Exec
import Control.Concurrent (rtsSupportsBoundThreads)
import Control.Concurrent.Lifted (threadDelay)
import Control.Exception (finally)
import Control.Monad
import Control.Monad.Error
import Data.Functor
......@@ -194,8 +195,9 @@ runJobProcess jid s = withErrorLogAt CRITICAL (show jid) $
forkWithPipe :: ConnectConfig -> (Client -> IO ()) -> IO (ProcessID, Client)
forkWithPipe conf childAction = do
(master, child) <- pipeClient conf
pid <- forkProcess (closeClient master >> childAction child)
closeClient child
pid <- finally
(forkProcess (closeClient master >> childAction child))
$ closeClient child
return (pid, master)
-- | Forks the job process and starts processing of the given job.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment