Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spawnChannel might wait indefinitely #271

Open
edsko opened this issue Feb 4, 2016 · 1 comment
Open

spawnChannel might wait indefinitely #271

edsko opened this issue Feb 4, 2016 · 1 comment
Labels
Projects

Comments

@edsko
Copy link
Member

edsko commented Feb 4, 2016

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
Copy link
Member Author

edsko commented Feb 4, 2016

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

@hyperthunk hyperthunk added this to To do in Release 0.8 Nov 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Release 0.8
  
Backlog
Development

No branches or pull requests

1 participant