-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
tcp conn pool: fix wrong connection pool deletion #37944
base: main
Are you sure you want to change the base?
Conversation
fixes envoyproxy#37679 Co-authored-by: Marko Lukša <[email protected]> Signed-off-by: Zuzana Miklankova <[email protected]>
As a drive by during triage: I think this PR warrants a unit test. Also, in the event this occurs, I think the |
@zuercher Thanks. I will work on that. |
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.
In addition to adding a test, please add comments describing what is happening (basically the same content as the analysis in the linked issue).
/wait
Signed-off-by: Zuzana Miklankova <[email protected]>
Signed-off-by: Zuzana Miklankova <[email protected]>
Hello, I added a test and explanatory comment to the code. This comment also explains why in my opinion |
The tests that failed in CI seem to be unrelated to this PR. |
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.
Thanks for working on a test, but this test will pass with or without the functional change in this PR. Can you make the test so that it would fail without your change?
/wait
@@ -7079,6 +7079,70 @@ TEST_P(ClusterManagerLifecycleTest, ConnPoolsIdleDeleted) { | |||
} | |||
} | |||
|
|||
TEST_P(ClusterManagerLifecycleTest, ConnPoolsCorrectDeleted) { | |||
TestScopedRuntime scoped_runtime; |
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.
This isn't used; delete
Thank you for looking at the test @ggreenway. The problem is that we cannot easily The conditions for the issue are described in #37944 in detail. To trigger the Because this issue is a race condition, timing is important to create a test |
In the unit test you wrote, there are no other threads, and all actions happen in a deterministic order, so you should be able to write the test so that it will fail without your fix. I think you just need to make all the events that you wrote in your diagnosis of the issue happen in the described order. |
Thanks. |
Commit Message: Fixes an issue when active tcp conn pool is incorrectly deleted: After an empty tcp conn pool is added to the deferred deletion list the connection pool is removed from the pool map. Then, if new conn pool for the same host with the same hash_key is created before the deferred deletion is cleared it will be incorrectly deleted, because
tcpConnPoolIsIdle
erases the pool based on its hash_key. See detailed description in #37679.Additional Description: N/A
Risk Level: Low
Testing: unit
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A
Fixes #37679