haskell-distributed / haskell-distributed/distributed-process

[DP-104] spawn without hearbeats

Open
#197 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

[Imported from JIRA. Reported by Facundo Dominguez @facundominguez) as DP-104 on 2015-02-24 11:57:14]
by Facundo Dominguez at https://cloud-haskell.atlassian.net/browse/DP-104:

It looks like n-t-tcp does not implement heartbeats, nor does the n-t documentation ask for that. Yet, spawn seems to rely on monitoring to learn of disconnections.

spawn uses delay, which won't run the spawned process unless it gets either a monitor notification or an ack from the caller. On the other hand, the caller can complete the call to spawn before the ack to delay arrives. If a disconnection occurs at this point, the spawned process will block indefinitely.

A simple fix is to stop using delay, and ask the user to take extra precautions if the spawned action is killing the remote node.

A simple workaround is to have the user use spawnAsync directly.


If call starts using cpDelayed as proposed in https://github.com/haskell-distributed/distributed-process/pull/183, the spawned process could block indefinitely if there is a disconnection. The call to call would not complete, but there wouldn't be a way to interrupt it while avoiding leaking the spawned process.

A fix for this could be to give up monitoring the spawned process and avoid using cpDelayed.

Thoughts?

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 tracing spawn, delay, spawnAsync, and call, then review how n-tcp monitoring and heartbeats handle disconnections. Compare the cpDelayed proposal in pull request 183 and determine the intended behavior when disconnection occurs before the acknowledgement; done should prevent the spawned process or call from blocking indefinitely without leaking work.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
distributed-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.