amqp icon indicating copy to clipboard operation
amqp copied to clipboard

In rare cases, sending on c.deadlines can block indefinitely.

Open puellanivis opened this issue 7 years ago • 3 comments

When heartbeater receives a close notification, it stops receiving on c.deadlines, this gives a race condition where it is possible for the reader goroutine sending a deadline on the c.deadlines channel to get caught without a receiver and block indefinitely here.

Solution is relatively simple, include a done chan *Error into reader just like on heartbeater allowing reader to break out of the blocking send.

This is Low Priority, because even running at 1000 open/closes in parallel as fast as my computer could for about 2½ hours, I found only a handful. And best practices should be using a single long-lasting connection at a time anyways, so few should ever actually see this manifest, let alone have it be a serious concern, but I thought it a good idea to document anyways.

puellanivis avatar Nov 08 '18 12:11 puellanivis

@puellanivis thank you for digging in. Please submit a PR since you understand the issue well enough already? That would be much appreciated. Thank you.

michaelklishin avatar Feb 16 '19 21:02 michaelklishin

I understand. I can work on it at some point, but am currently in hospital. 😢 As noted, it is low priority, as Best Practice should mitigate its expression to very rare cases.

puellanivis avatar Mar 05 '19 15:03 puellanivis

@puellanivis no worries. We wish you a speedy recovery!

michaelklishin avatar Mar 06 '19 03:03 michaelklishin