haskell-distributed / haskell-distributed/distributed-process

spawnChannel might wait indefinitely

Open
#271 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
Haskell
Stars
751
Forks
99
Avg merge
45m
Merged PRs (30d)
2

Description

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).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation of spawnChannel and compare its handling with spawn, especially the SendPort result and process monitoring. Ensure a remote process that dies before returning a SendPort does not leave the caller waiting indefinitely, and that the resulting null port triggers the intended monitor behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.