Commit 4cfa01f4 authored by Petr Pudlak's avatar Petr Pudlak
Browse files

When starting the Luxi daemon, check if it's able to fork



If a Haskell program is compiled with -threaded, then inheriting open
file descriptors doesn't work, which breaks our job death detection
mechanism. (And on older GHC versions even forking doesn't work.)

Therefore let Luxi daemon check and let it fail to start, if it detect
it has been compiled with -threaded.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent d182955c
...@@ -63,11 +63,13 @@ import qualified Ganeti.Query.Cluster as QCluster ...@@ -63,11 +63,13 @@ import qualified Ganeti.Query.Cluster as QCluster
import Ganeti.Path ( queueDir, jobQueueLockFile, jobQueueDrainFile import Ganeti.Path ( queueDir, jobQueueLockFile, jobQueueDrainFile
, defaultMasterSocket) , defaultMasterSocket)
import Ganeti.Rpc import Ganeti.Rpc
import qualified Ganeti.Query.Exec as Exec
import Ganeti.Query.Query import Ganeti.Query.Query
import Ganeti.Query.Filter (makeSimpleFilter) import Ganeti.Query.Filter (makeSimpleFilter)
import Ganeti.Types import Ganeti.Types
import qualified Ganeti.UDSServer as U (Handler(..), listener) import qualified Ganeti.UDSServer as U (Handler(..), listener)
import Ganeti.Utils (lockFile, exitIfBad, watchFile, safeRenameFile) import Ganeti.Utils ( lockFile, exitIfBad, exitUnless, watchFile
, safeRenameFile )
import qualified Ganeti.Version as Version import qualified Ganeti.Version as Version
-- | Helper for classic queries. -- | Helper for classic queries.
...@@ -442,6 +444,9 @@ checkMain _ = return $ Right () ...@@ -442,6 +444,9 @@ checkMain _ = return $ Right ()
-- | Prepare function for luxid. -- | Prepare function for luxid.
prepMain :: PrepFn () PrepResult prepMain :: PrepFn () PrepResult
prepMain _ _ = do prepMain _ _ = do
Exec.isForkSupported
>>= flip exitUnless "The daemon must be compiled without -threaded"
socket_path <- Path.defaultQuerySocket socket_path <- Path.defaultQuerySocket
cleanupSocket socket_path cleanupSocket socket_path
s <- describeError "binding to the Luxi socket" s <- describeError "binding to the Luxi socket"
......
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