In rare cases, sending on c.deadlines can block indefinitely.
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 thank you for digging in. Please submit a PR since you understand the issue well enough already? That would be much appreciated. Thank you.
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 no worries. We wish you a speedy recovery!