Skip to content

Conversation

OlegStotsky
Copy link
Contributor

@OlegStotsky OlegStotsky commented Feb 5, 2024

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.

@OlegStotsky
Copy link
Contributor Author

@ofekshenawa please take a look

@Aden-Q
Copy link

Aden-Q commented Feb 6, 2024

@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.

@OlegStotsky
Copy link
Contributor Author

@Aden-Q I've added another check after we acquire the mutex again. Should be correct now.

@OlegStotsky
Copy link
Contributor Author

@vmihailenco could you take a look please

@chayim chayim added this to the connection-improvements milestone Feb 14, 2024
@chayim chayim requested a review from ofekshenawa February 14, 2024 13:30
@ofekshenawa ofekshenawa linked an issue Feb 14, 2024 that may be closed by this pull request
@ofekshenawa ofekshenawa merged commit 36bab9c into redis:master Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUGS] data race in connection pool management

5 participants