Closed OlegStotsky closed 5 months ago
@ofekshenawa please take a look
@OlegStotsky You should mention my issue here (if you saw it). And I don't think it's the correct way to fix the issue. Even though it can protect the variable to be mutated while being read. There still can be interleaving execution flows, causing some errors on the semantic level (for example, read the value in one goroutine, afterwards it is updated by another goroutine. In which case there will not be data race, but there is a semantic error). I think we need to we protect the full scope of the critical section, instead of doing: lock-unlock, then lock-unlock again.
@Aden-Q I've added another check after we acquire the mutex again. Should be correct now.
@vmihailenco could you take a look please
Currently there is a race in newConn. This means that any code that uses this client will fail tests with -race flag enabled. This PR fixes this.