<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi Alex. I'm testing thespian in rss2irc, FYI:&nbsp;<a href="http://joyful.com/darcsden/simon/rss2irc/browse/rss2irc.hs#L-114">http://joyful.com/darcsden/simon/rss2irc/browse/rss2irc.hs#L-114</a>&nbsp;.&nbsp;</div><div><br></div><div>Maybe there's a better way to use it, but for now it brings me one extra thread and higher memory usage/leakage - an instance grew to 350M overnight where I'd normally see 50-100M. The leak may be in my code, but I haven't found it yet.&nbsp;Did you notice high memory usage when using thespian ?</div><div><br></div><div><div>Whether or not I end up keeping it, it has influenced the ordinary thread-based manager for the better, eg see forkMonitoredIO which is like a poor man's monitor using exceptions rather than actor messages.</div><div><br></div><div>Best,</div></div><div>- Simon</div><div><br></div><br><div><div>On Oct 12, 2011, at 8:44 AM, Simon Michael wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi Alex, thanks for the reply (it didn't seem to reach haskell-cafe, if that matters) and the update on status. I passed over CloudHaskell as it seemed (a) over-complex for my needs and (b) not ready, eg not on hackage. I need something that will still permit cabal install rss2irc. But perhaps that's not far off. I'll look again more closely, at both.<br><br>Best - Simon<br><br><br>On Oct 11, 2011, at 10:48 PM, Alex Constandache wrote:<br><br><blockquote type="cite">Hi Simon,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Sorry for the late reply. I no longer work on thespian, as there is<br></blockquote><blockquote type="cite">another project, called Cloud Haskell which provides much more<br></blockquote><blockquote type="cite">functionality than thespian (including Erlang style distributed<br></blockquote><blockquote type="cite">computing). It is not available on Hackage, but it lives on Github at<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><a href="https://github.com/jepst/CloudHaskell">https://github.com/jepst/CloudHaskell</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Simon Peyton-Johnes himself seems to be associated with the project,<br></blockquote><blockquote type="cite">so you should have a look at it. If it does not match your needs, feel<br></blockquote><blockquote type="cite">free to hack thespian and send me a pull request on bitbucket. You are<br></blockquote><blockquote type="cite">the second person who emailed about thespian in the last month, so<br></blockquote><blockquote type="cite">maybe I should reconsider the decision to abandon it (which was<br></blockquote><blockquote type="cite">motivated by my desire to avoid contributing to the insane<br></blockquote><blockquote type="cite">fragmentation that plagues Hackage).<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">--Alex<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On Sun, Oct 9, 2011 at 12:45 PM, Simon Michael &lt;<a href="mailto:simon@joyful.com">simon@joyful.com</a>&gt; wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite">Hi Alexander,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I went looking for something to clean up rss2irc's thread management, and<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">your recently released thespian package looks like the simplest, most<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">practical actors/erlang/OTP-ish lib for haskell so far. Thanks!<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I need to restart threads (actors) in a controlled way when they die or<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">hang. I think some of all of that is also part of Erlang/OTP, and maybe it's<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">already on your todo list. Here are some notes I made, for your interest and<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">in case you have any further thoughts.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I thought of adding some actor-transforming combinators like these:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-- | Spawn the specified action and restart it whenever it dies, unless<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-- &nbsp;&nbsp;the restart frequency exceeds any of the given maximum frequencies in<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-- &nbsp;&nbsp;which case throw an exception.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">restart :: [Frequency] -&gt; IO a -&gt; IO Address<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">restart fs action = spawn $ do<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;setFlag TrapRemoteExceptions<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;let start times = []<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;forever<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;t &lt;- getCurrentTime<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;update start times<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;when (any fs exceeded by start times) throw error<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;worker &lt;- spawn action<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;monitor worker<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;receive worker [Case _ -&gt; return ()]<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-- | Convert hangs to exceptions using a watchdog timer: spawn the<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-- &nbsp;&nbsp;specified action under the control of a watcher which monitors it and<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-- &nbsp;&nbsp;also kills it and throws an exception if the worker ever fails to<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-- &nbsp;&nbsp;send (something) to the watcher within the specified interval.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">watchdog :: Seconds -&gt; (Address -&gt; IO a) -&gt; IO Address<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">watchdog t action = spawn $ do<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;watcher &lt;- self<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;worker &lt;- spawn $ action watcher<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;monitor worker<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;forever<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;receiveTimeout t [Case _ &nbsp;-&gt; return ()<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default -&gt; throw error<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">which I would use something like:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">main = do<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;(feed, bot) &lt;- ...<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;spawn $ do<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;reader &nbsp;&nbsp;&nbsp;&lt;- restart [MaxPerHour 2] $ watchdog 60 $ feedReader feed bot<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;announcer &lt;- restart [MaxPerHour 2] $ watchdog 60 $ ircAnnouncer bot<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;responder &lt;- restart [MaxPerHour 2] $ watchdog 60 $ ircResponder bot<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;monitor reader<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;monitor announcer<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;monitor responder<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;setFlag TrapRemoteExceptions<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;receive [Case e :: RemoteException -&gt; exitFailure (show e) -- one of the<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">above died or hung too frequently<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">but the types aren't right. I'm not sure if these combinators are possible<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">with the current thespian api. Also they would complicate things, eg what is<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">the address of a restarted actor ?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">On second thoughts it might be better if these features were built in to the<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">library. I imagine something like:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">main = do ...<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;reader &nbsp;&nbsp;&nbsp;&lt;- spawnWith [RestartSpec [MinInterval (minutes 5), MaxPerHour<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">3, MaxPerWeek 6], Watchdog (seconds 60)] $ feedReader feed bot<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">feedReader = do<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;forever<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;poll feed, do stuff<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;resetWatchdog<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">What do you think ?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Best - Simon<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">-- <br></blockquote><blockquote type="cite">AC<br></blockquote><blockquote type="cite">I used to have a signature, but now I don't.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">-----BEGIN PGP PUBLIC KEY BLOCK-----<br></blockquote><blockquote type="cite">Version: BCPG v1.45<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">mQINBE2kb5sBEADO/4u9AVkyz+jEnhgYzfdJ2tIIxOfAL4rqx2jXbxeFVq7vyBRS<br></blockquote><blockquote type="cite">vM+K8u2Xw2TBC0dXzNy9GiBf9qjZS1EGPPiIvTLsp5aIoQLsO7E6H6g7Z5eqijMC<br></blockquote><blockquote type="cite">c4qhrnmWsxcOZv8s0iil6H6OXa/EQzP2M1DRmyU8W49Cvo+Jg9hHZGbvdqpNrmYZ<br></blockquote><blockquote type="cite">ZV5cA9hTneAFe7wixfQ7GDu80dCELmwwWX2adVpeW5dyX0u42Bp7e263GU1wPWTY<br></blockquote><blockquote type="cite">t5CTkrgvHkFu7Hu3SGt66Q95xvCkK/RFLJbKJyeuHOY3uIa6YWKtMCNPcFz9C520<br></blockquote><blockquote type="cite">D+MQElWU9xFssxXj626v/GhTGoOPKu948rRgZl5OrBJjzOqaGtrDxuT45qjBfYV2<br></blockquote><blockquote type="cite">pkVzkTD2/3WNQNZapdrwNjf/fgomUVBTbeow1zPEypg1LHdX2Y58M54l6hCxbcgy<br></blockquote><blockquote type="cite">JHALDCnROoEPeupJfncIYkp54hL3MJCspPHJoBMHpwfXZgmTNNfEQE2LX4recZ/7<br></blockquote><blockquote type="cite">PRIAntZ6/MZjBH/1vGc+BcIT5S5Z2J1INeZkEscz3pSl5iR8wYE1VyBRreaQptmq<br></blockquote><blockquote type="cite">DtIIc2qyRN+BwbF7T0zCdYB2MHW1PA0pS3r4k//K8bmEf1ThH7u9jYuKKANDCltI<br></blockquote><blockquote type="cite">ariGvz5/CxmW1+JnkSZtwb8w+3qcaMgOGYJhyD6K6RlYqq2htkjteWSdOwARAQAB<br></blockquote><blockquote type="cite">tDpBbGV4IENvbnN0YW5kYWNoZSAoYWxleCkgPGFsZXhhbmRlci50aGUuYXZlcmFn<br></blockquote><blockquote type="cite">ZUBnbWFpbC5jb20+iQIcBBMBAgAGBQJNpHAsAAoJEHNeWOpiNrFPBbUP/RCJC7C/<br></blockquote><blockquote type="cite">78g0lQ1mvOzmfWoZ/tc0RceZqnfYYhm8VbZ6oNT3G4s2b7T5NdGCWqL1hGYVHupM<br></blockquote><blockquote type="cite">6TB4KA2eW8/3xh+oxbdC70i1WQYyfE81oKTSfW2+kBqtPIXueTs9AJ5rRX4cpPBr<br></blockquote><blockquote type="cite">8cDTx6tjCe+Vew59hUQ8JxAzs32Ol5mGOf4wpHhS4Un1mJwO+as0kHJnsA15dXoI<br></blockquote><blockquote type="cite">Moo15NiJL9y77+8u1T6tHbGLYT9J/paoWOglA02FQIdlOAmQdCNhjZ4HKCKmMKsn<br></blockquote><blockquote type="cite">WwlctvORzH+VtIpF9oxBtu0n3pPAE3wU4GyyVtg27wa+LNg7CEVHhJ/m6QSoPRFa<br></blockquote><blockquote type="cite">TLYhK7OP4bOPdWZZUM1En4mWQFnb2fyKDPUIjqtbMBP6dcZin0nwRxZzngdLcdpm<br></blockquote><blockquote type="cite">Prz14F5aS1+NvZOXhkPevBC6xXOnLwEr+egyM0jMGPdE3YnqMKOVR3e6bGE/wvPy<br></blockquote><blockquote type="cite">OKtebMhFqLy1Yg87p3IU3Tv0Y1WV8GVEZr5lYHkbgM3yIY/WlH+MO5I4j7YXUdXf<br></blockquote><blockquote type="cite">gvMjOMOxZ4wG8QEfkpdpaBm6JcRAkf9gb7IgBiOmdtC/N8s02NWyjRchvb/kOz5C<br></blockquote><blockquote type="cite">eSCm6WV07Yhzxm+XTn+L8VxSN5YwCsF7gwD+Mtmone5TdmHS+7JJtjiq8WIbQrv3<br></blockquote><blockquote type="cite">/cwj2+7pnh7F032s2TpoJw0Og5HqjakiIkzYiQI2BBMBAgAgBQJNpHAsApsPBosJ<br></blockquote><blockquote type="cite">CAcDAgSVAggDBJYCAwEFiQM9P4AACgkQc15Y6mI2sU8rfRAAtBCtd+XVjuqR/Of4<br></blockquote><blockquote type="cite">vy8Ev6N1/naqg7zOOQzQXT5UNpuoHO+y4oIYDvjkhGlxK4fVeIUHTQvhXS/INqyX<br></blockquote><blockquote type="cite">3oCKXYrzrsAgrq5FVdkRPwUV6H52ik/ani+IoGP2u85Y10DTnPGQnMzVwtN9Z6/T<br></blockquote><blockquote type="cite">m486XA460J4jCIrRMpm+OJDHN6xUkgZFXaMW+scQK4At2wwcNvuOp9I9T4HP3viy<br></blockquote><blockquote type="cite">b4g5IVgTsSZZoCIlSEvch2jGbM4hXDnLPFfIdSDxxn91sRgcmkNxCtGvKMVTDGYK<br></blockquote><blockquote type="cite">JBvJYKki+X/CXfKlPwxTqHHjEbm8+uLyLDL32d7XTiS+0q31XthrVnVummiyIVtp<br></blockquote><blockquote type="cite">tVhaBeY0JjX6Umi8DeaUWmT1xOckMIXMoAZBGux94hyaeKNEsSYXKQeM7nAvbEf9<br></blockquote><blockquote type="cite">EYPwoG82qRj/NyxqVH/Cx2IM24OYfoW2HwtU9l3QCHkCK1txCd3PvcWIFoSbwvX5<br></blockquote><blockquote type="cite">1wB8/TgdhY4VM5BEJTBHTd8YZ6qi2pHeu+RdZoSCCHqeZA2WmGFpNsxRvHqw0sow<br></blockquote><blockquote type="cite">YyadDulJu8AWT1+K0DTIxa3YWYIjMV9a/1LV5+/b4xx6KLvIbgS5aWsMMqmdhxMR<br></blockquote><blockquote type="cite">w1cQ8JtkUSBgx8XzZIXqbMZEIhUmGeTGFBm+dKv91vTvxcM0vrrKPzAgiobRL2EE<br></blockquote><blockquote type="cite">43JwGJtFoGAc4zoRBUcXoRzodkc=<br></blockquote><blockquote type="cite">=9igb<br></blockquote><blockquote type="cite">-----END PGP PUBLIC KEY BLOCK-----<br></blockquote><br></div></blockquote></div><br></body></html>