go-lumber
go-lumber copied to clipboard
Possible race condition in ReceiveAck
In ReceiveAck we first set a deadline on the read at https://github.com/elastic/go-lumber/blob/d3a66da160e5b6d9526ebab911e7e13526551e28/client/v2/client.go#L176
And then do the read a few lines later at: https://github.com/elastic/go-lumber/blob/d3a66da160e5b6d9526ebab911e7e13526551e28/client/v2/client.go#L183
If the conn is ever replaced in between those calls, the Read can run forever, this means Receive Ack could wait forever waiting for Acks that will never arrive, because the conn they would come in on has been closed, and no Acks will arrive on the new conn.
This can happen if another go routine can replace the conn.