Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle interrupted messages gracefully #423

Open
facundominguez opened this issue May 14, 2019 · 1 comment
Open

Handle interrupted messages gracefully #423

facundominguez opened this issue May 14, 2019 · 1 comment

Comments

@facundominguez
Copy link
Contributor

facundominguez commented May 14, 2019

It seem interrupting send calls of the TCP transport can sometimes produce the receiver side to append incomplete messages with unrelated messages and deliver that to upper layers.

Either interrupted messages should become impossible, or the receiver should be stopped from delivering these messages upwards.

See the discussion in haskell-distributed/network-transport-tcp@9ec9c1a#r33404578

cc @andriytk

facundominguez referenced this issue in haskell-distributed/network-transport-tcp May 14, 2019
Instead of using schedule/runScheduled actions separately,
because they are exceptions unsafe, we introduce a
`withScheduledAction` function that cares about the safety
by providing correct finalizers.

X-Bug-URL: https://cloud-haskell.atlassian.net/browse/DP-109
@andriytk
Copy link
Contributor

The problem is that the receiver has no idea whether msg is Ok or not. It just reads the specified number of bytes received from the 1st msg chunk (see recvWithLength). So I think the right solution would be at the sender side to send the whole msg and avoid being interrupted on sendMany by some outer non-IOException (like ProcessLinkException which happens quite often on our setup). This can be done by calling sendMany in a separate green-thread. The OS buffers become available quite fast, usually. And even if the parent thread will die in a meanwhile because of an exception - it should not take long for the child to finish.

See the proposed patch at haskell-distributed/network-transport-tcp#86.

@LaurentRDC LaurentRDC transferred this issue from haskell-distributed/network-transport-tcp Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants