Strange behaviour in GHCi using Cloud Haskell Platform

131 Views Asked by At

Following the tutorials (http://haskell-distributed.github.io), this code – after calling dev in GHCi – lets one CPU core spin up to 100% and stays at that level indefinitely. This seem to happen due to the call to closeTransport.

However, evaluating the code in GHCi line by line, does not show this effect. So where does the difference come from and how can I correctly clean up?

import Network.Transport (closeTransport)
import Network.Transport.TCP (createTransport, defaultTCPParameters)
import Control.Distributed.Process.Node (newLocalNode, closeLocalNode, initRemoteTable)

dev :: IO ()
dev = do
  Right t <- createTransport "localhost" "9000" defaultTCPParameters
  n <- newLocalNode t initRemoteTable
  -- do the work
  closeLocalNode n -- <- doesn't affect the observed behaviour
  closeTransport t
0

There are 0 best solutions below