Closed majiru closed 2 years ago
Any updates on this?
Not yet - this is on my schedule for next week
OK - I've checked in a fix for this. FYI, this is the first time I've used "go test -race", neat little tool.
Although I recognized most of these race conditions it found in the original code, I had deemed them safe or non-consequential for typical use cases.
For now, in this Go code update, I removed all feasible race conditions, including ones the tool did not find. This could have some impact on performance, but hopefully not too much. If it is noticed we can move back to the safe race scenarios.
We are seeing a race condition crop up with the connection state handling when we see attempts to reestablish connections for a active subscription. This can happen particularly often if we create a lot of subscriptions at once, causing the upstream OpenPDC to reject at least a couple of them. It seems particularly common in cases in which the connection is reset before the code finishes the 'connection setup'. I have isolated a test case for reproducing this bug:
This is formatted as a unit test to make it easier to run against the go race detector by doing
go test -race