network-transport-tcp icon indicating copy to clipboard operation
network-transport-tcp copied to clipboard

[NTTCP-12] Fix potential locking when waiting on the crossed MVar

Open qnikst opened this issue 9 years ago • 1 comments

[Imported from JIRA. Reported by Facundo Dominguez @facundominguez) as NTTCP-12 on 2015-05-27 20:55:45] The handler of incomming requests is waiting on the {{crossed}} MVar before accepting an incoming connection.

This wait is potentially indefinite (if the CrossConnectRequest message does not arrive), and it looks unnecessary. At least I cannot come up with any problematic interleaving of events in the absence of it.

We should either remove the {{crossed}} MVar or document what is helping to accomplish (preferrably the problematic ordering of events that is being ruled out).

There is the commit [message|https://github.com/haskell-distributed/network-transport-tcp/commit/6207de60bae7fcf39c108a49bdc152a98abdd277] of the commit that introduces it. Unfortunately, it doesn't explain the "certain ordering of events" that motivates it.

qnikst avatar Jun 17 '15 18:06 qnikst

It waits for the crossed MVar because it needs to wait for the crossing connecting process finish. I just put some thoughts into this crossing states today and find other potential problems, which I described in another issue.

yihuang avatar Jul 24 '18 10:07 yihuang