distributed-process icon indicating copy to clipboard operation
distributed-process copied to clipboard

[DP-103] Race condition in call

Open qnikst opened this issue 10 years ago • 0 comments

[Imported from JIRA. Reported by Facundo Dominguez @facundominguez) as DP-103 on 2015-02-20 18:27:36] By Facundo Dominguez at https://cloud-haskell.atlassian.net/browse/DP-103

The implementation of call [1] contains a text like the following:

-- We are guaranteed to receive the reply before the monitor notification
-- (if a reply is sent at all)

As discussed in https://cloud-haskell.atlassian.net/browse/DP-99 this is not true, and I have hit the case in practice where call fails with "call: remote process died: DiedNormal", because the monitor notification arrives before the response.

I don't know how to fix it yet. Maybe using a call to cpDelay after cpSend:

spawnMonitor nid (proc `bindCP` cpSend dict us `bindCP` cpDelay us (cpReturn ()))

and having call send () after unmonitoring.

[1] https://github.com/haskell-distributed/distributed-process/blob/4d3472ac483476e743c258e4976d699aae113b1e/src/Control/Distributed/Process/Internal/Spawn.hs#L110-L132

Fixed by https://github.com/haskell-distributed/distributed-process/pull/183

qnikst avatar Jun 16 '15 16:06 qnikst