mesh icon indicating copy to clipboard operation
mesh copied to clipboard

encryptedTCPSender.Send() holds a lock over a TCP send

Open bboreham opened this issue 4 years ago • 1 comments

Lock is not released until the Send() returns.

Taken together with #125 this means it can hold a lock forever.

Sender and receiver each maintain state including a sequence number, so if we unlock before calling Send() it's possible that messages get out of order.

Seen at https://github.com/weaveworks/weave/issues/3762

bboreham avatar Jan 28 '20 14:01 bboreham

I am now thinking this is not a bug, on the basis:

  • there is one lock per outgoing socket
  • the Send() on the socket will block all callers when the buffer is full

therefore it doesn't make any difference if we block earlier on the lock.

bboreham avatar Jan 29 '20 09:01 bboreham