Request for feedback: `distributed-process` leaning into static pointers

With the upcoming release of GHC 10, static pointers’ definition has been tightened, and bugs have been fixed. This is a great opportunity to re-evaluate the use of static pointers within Cloud Haskell’s standard implementation, distributed-process.

Since Cloud Haskell and distributed-process predate the StaticPointers GHC extension, a parallel, partially overlapping system called the RemoteTable was devised, and is still used today. I have a pull request to remove this concept from distributed-process, and instead fully lean into static pointers.

The advantage is a drastically simpler handling of static values, and no loss of functionality, but it is a breaking change, and so I want to get this right.

If you’re interested in Cloud Haskell, I would greatly appreciate a look at the pull request. I would love to hear your thoughts

14 Likes

Heya,

I’m not actually using cloud Haskell so I neither have skin in the game nor really know what I’m talking about, but I wonder if this would mean that rolling deployments aren’t possible anymore? Iiuc ghc only guarantees stable static pointers within the same binary.

So sending static pointers over the network would mean that all instances need to be upgraded at once, right?

It’s a bit contentious whether rolling deployments were ever possible in practice.

The RemoteTable functionality supports referring to functions either by static pointers, or by text label. A function referred to by text label could be shared in two different binaries. However, you would have to know that all of the contents of your RemoteTable are exclusively labels, rather than static pointers.

The two production uses of distributed-process that I know of never relied on the ability to run separate binaries.

For what it’s worth, the general problem of cluster management (including upgrades) is something I want to look at next, but this has to leverage some work that I’m not ready to share just yet

1 Like

The need for identical binaries (dating back to the original paper, IIRC) has always been something that’s scared me off a bit. Would it be possible/sane to split the tables into one for only labels, and one for static pointers? If that were a thing, would exclusively using the label-based table make it safe to pass messages between different binaries, using the cloud-haskell libraries? Or would there still be other complications that would make that not work?

To be clear, the requirement to use identical binaries is ONLY if you want to call spawn or call, but you don’t have to! I used to run heterogeneous Cloud Haskell clusters with zero issues. Instead of using call, we used an interface with one top-level loop like:

main = do
    ... setup ...
    forever $ 
        receiveWait 
            [ match (handleA :: A -> Process ())
            , match (handleB :: B -> Process ())
            , match (handleC :: B -> Process ())
            ]

instead of having handleA/handleB/handleC be static functions. I never tried rolling upgrades, but there’s no fundamental reason a cluster that doesn’t use spawn/call couldn’t do rolling upgrades


It would be possible, but I don’t think this is sane to hardwire in the distributed-process framework itself. Text labels can be done user-side, or you can use something like above

2 Likes

Cool, that’s good to know. I used to use Erlang, and just loved the way you could send fairly arbitrary data structures all over the place. It seems like that was always the goal of cloud haskell, but I don’t think I’ve ever seen an example of quite how that works. Looks like it does work just fine, if I can figure out how all the parts fit together :slight_smile:

1 Like