distributed-process icon indicating copy to clipboard operation
distributed-process copied to clipboard

spawnChannel might wait indefinitely

Open edsko opened this issue 9 years ago • 1 comments

If the remote process (or node, or the connection, ..) dies before it manages to send a SendPort back to us, we will wait forever. Instead, spawnChannel should monitor the remote process and if dies, construct a "null port", just like spawn does:

nullSendPort :: ProcessId -> SendPort a
nullSendPort nullPid = SendPort (SendPortId nullPid 0)

fromMaybeSendPort :: ProcessId -> Maybe (SendPort a) -> SendPort a
fromMaybeSendPort _   (Just sendPort) = sendPort
fromMaybeSendPort pid Nothing         = nullSendPort pid

Monitoring such a null port has the intended effect (the monitor will fire immediately).

edsko avatar Feb 04 '16 10:02 edsko

We're currently experimenting with a module that fixes both this ticket and #103.

edsko avatar Feb 04 '16 13:02 edsko