Open
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}}.
Metadata
Metadata
Assignees
Type
Projects
Status
Backlog
Milestone
Relationships
Development
No branches or pull requests
Activity
[-]spawn may leak messages when interrupted[/-][+][DP-112] spawn may leak messages when interrupted[/+]