New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potential race condition in Connection module #31
Comments
This issue is due to the fact that the assignment c.allocator = newAllocator(1, c.Config.ChannelMax) is done at the same time both during OpenConnection in OpenComplete function during shutdown. While shutdown is protected my the structure mutex "m" OpenComplete is not. A solution would be to protect this function with the same mutex, but to carefully double check if it can create other issues. |
…itmq#31): These ones were the ones testing Open scenarios. The issue is that Open and Close, rwc.Open and rwc.Close can at the same time write on: c.allocator = newAllocator(1, c.Config.ChannelMax) connection.go line 444 and connection.go line 849 while shutdown is protected by the structure mutex m, OpenComplete() is not causing the race. Not sure if the library should be protected in this case adding Lock also in OpenComplete(). In any case the tests were just testing Open, so the rwc.Close() can be moved in the main function at the end avoiding the race and not affected the test functionality
…itmq#31): These ones were the ones testing Open scenarios. The issue is that Open and Close, rwc.Open and rwc.Close can at the same time write on: c.allocator = newAllocator(1, c.Config.ChannelMax) connection.go line 444 and connection.go line 849 while shutdown is protected by the structure mutex m, OpenComplete() is not causing the race. While it's not clear if the library should protect this eventuality, the tests are testing the Open function, so I think the close can be put in the main thread avoiding the race and not affecting the test validity
#56 merged! |
Running our tests with
-race
flag, it reports a race condition in the Connection module. Pasting here one stack trace to investigate.The text was updated successfully, but these errors were encountered: