From dd7812b3d814ecea6124d3cbedc329f6c6851bef Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 21 Oct 2015 16:59:06 -0400 Subject: thoughts --- doc/todo/concurrency.mdwn | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/doc/todo/concurrency.mdwn b/doc/todo/concurrency.mdwn index 712747f0..fa0e22ea 100644 --- a/doc/todo/concurrency.mdwn +++ b/doc/todo/concurrency.mdwn @@ -19,14 +19,35 @@ off a sub-process to ensure the property. If forkProcess could be used, it could fork a subprocess that knows the action it's to perform, and jiggers stdio to feed through a pipe back to the -parent. But, I have had bad luck in the past using forkProcess in haskell, +parent. + +But, I have had bad luck in the past using forkProcess in haskell, in combination with the -threaded runtime. + forkProcess comes with a giant warning: since any other running threads + are not copied into the child process, it's easy to go wrong: e.g. + by accessing some shared resource that was held by another thread in + the parent. + +It may well be that since propellor has very +little shared resources, and properties are run quite independently of +one-another, a forkProcess to run a property might not be a problem. + +At least, until someone gets creative: + + foo = property "foo" $ do + v <- liftIO newEmptyMVar + ensureProperty $ + foo v `race` bar v -- FAIL + +We could detect if inside ensureProperty and refuse to do anything +concurrent because the user might be up to such tricks. + --- -Instead, execing a new process would work. But, how to tell that -sub-process be told which property it's supposed to -ensure? There's no property serialization, and not even a Eq to use. +Instead of forking, execing a new process would work. But, how to tell that +sub-process which property it's supposed to ensure? There's no property +serialization, and not even a Eq to use. Hmm, if it could come up with a stable, unique Id for each property, then the sub-process could be told the Id, and it'd then just look through its @@ -51,7 +72,7 @@ x y a b are not top-level properties of a Host, so won't get unique Id's. Unless we can build up some tree of Id's that can be walked from the top-level down to the sub-properties, this won't work. Help? -Also, what about mixing concurrently with ensureProperty? +Also, what about mixing concurrency with ensureProperty? foo = property "foo" $ do liftIO defCon5 -- cgit v1.2.3