couchbase / go-couchbase

Couchbase client in Go
https://godoc.org/github.com/couchbase/go-couchbase
MIT License
321 stars 92 forks source link

possible race condition in connection pool #91

Open burner-account opened 5 years ago

burner-account commented 5 years ago

see conn_pool.go see connectionPool see connectionPool --> connCount see func (cp *connectionPool) connCloser()

You are using connCloser() as a go routine. Inside connCloser there is the assignment connCount = cp.connCount

Please consider using connCount = atomic.LoadUint64(&cp.connCount) instead, as the current solution might lead to race conditions.

I am not using/invested in couchbase, so please forgive the bad report style.