haskell-distributed / haskell-distributed/distributed-process

[DP-112] spawn may leak messages when interrupted

Open
#202 0 comments 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

[Imported from JIRA. Reported by Facundo Dominguez @facundominguez) as DP-112 on 2015-06-02 19:03:28]
{{spawn}} is waiting for some messages, but if it is interrupted, the messages may arrive at the mailbox without nobody ever reading them.

{code}
spawn :: NodeId -> Closure (Process ()) -> Process ProcessId
spawn nid proc = do
us <- getSelfPid
mRef <- monitorNode nid
sRef <- spawnAsync nid (cpDelayed us proc)
receiveWait [
matchIf ((DidSpawn ref _) -> ref == sRef) $ (DidSpawn _ pid) -> do
unmonitor mRef
send pid ()
return pid
, matchIf ((NodeMonitorNotification ref _ _) -> ref == mRef) $ _ ->
return (nullProcessId nid)
]
{code}

The only fix I see so far is to wrap the {{spawn}} definition with {{callLocal}}.

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 with the spawn definition shown in the issue and read the callLocal approach it identifies as a possible fix. Trace the interruption and message-waiting behavior, then verify that an interrupted spawn cannot leave messages in the mailbox without a reader.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.