-
Notifications
You must be signed in to change notification settings - Fork 74
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
Don't call OnConnectFailed when failed to connect during shutdown #113
Don't call OnConnectFailed when failed to connect during shutdown #113
Conversation
Signed-off-by: Corbin Phelps <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #113 +/- ##
=======================================
Coverage 74.95% 74.95%
=======================================
Files 22 22
Lines 1633 1633
=======================================
Hits 1224 1224
Misses 307 307
Partials 102 102
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cpheps can you add a test that creates the race condition and fails without this fix, but passes after the fix?
@tigrannajaryan I can try. I'm not sure how possible it is since you need to Stop the opamp client at certain point. I don't know if it's possible right now to force the client to block so we can hit that point. |
OK, please try. Ideally we want to clearly demonstrate that the PR really fixes the problem and an automated test helps a lot. If you find that it is impossible to write a test we can merge as is. |
@tigrannajaryan I've been messing around with this and I can't seem to get it consistent. I was able to write a test that triggered the race condition like 1 in 5 runs. The race conditions lies inside the The test I have was starting the client, waiting a few milliseconds, stopping it, the checking if There's only one other test for the websocket implementation that shows |
OK, let's merge this as is and maybe we can add more tests as part of #99 |
Fixes #111
Once
Stop()
is called on the websocket client we don't callOnConnectFailed
handler if a dial fails.Tested this fix on a system that was repeatedly showing the
OnConnectFailed
handler called during shutdown.