KAFKA-9190: Close connections with expired authentication sessions#7723
KAFKA-9190: Close connections with expired authentication sessions#7723hachikuji merged 2 commits intoapache:trunkfrom
Conversation
Signed-off-by: Ron Dagostino <rdagostino@confluent.io>
|
Thanks @rondagostino . That makes sense. I'm wondering how much effort it would be to create a test case which hits this path. |
|
You stated in https://issues.apache.org/jira/browse/KAFKA-9190 that the problem was found when debugging the flaky test failure
So this raises two issues. One is that in order to test this code path we would have to create a test where we have access to older and/or non-Java clients. The other issue is that I don't see how this code path was being executed. One thing that occurs to me is that maybe the act of debugging itself may have introduced an otherwise-impossible state. Maybe a thread was paused, for example, and any credential refresh thyat would normaly occur on the client side could not happen. Thoughts? |
|
I think the failing test hits this case for two reasons:
|
|
@hachikuji @rondagostino Yes, I think we can hit this in Agree that we should have a test for this and I think we could perhaps add a test in Good find @hachikuji ! |
36cdb25 to
782b2d1
Compare
|
@rajinisivaram Let me know if the added test looks good. I confirmed that it fails prior to the fix and passes with the fix. Also note that while writing the test I discovered that a client's SASL connection will never be disconnected even if it does not re-authenticate when the client fails to utilize |
rajinisivaram
left a comment
There was a problem hiding this comment.
@rondagostino Thanks for the update, left a few comments on the test.
Signed-off-by: Ron Dagostino <rdagostino@confluent.io>
782b2d1 to
850f498
Compare
|
@rajinisivaram All set. If you can merge it (and maybe don't squash the two commits to keep the autoboxing/unboxing commit separate) then I will follow up with a separate PR for |
hachikuji
left a comment
There was a problem hiding this comment.
I had a few pending comments on the test case, but looks like they all overlapped with @rajinisivaram's review 😄 . The updates LGTM, but I will let Rajini take a final look.
rajinisivaram
left a comment
There was a problem hiding this comment.
@rondagostino Thanks for the updates, LGTM. Will merge after @hachikuji 's last remaining comment is addressed.
…7723) This patch fixes a bug in `SocketServer` in the expiration of connections which have not re-authenticated quickly enough. Previously these connections were left hanging, but now they are properly closed and cleaned up. This was one cause of the flaky test failures in `EndToEndAuthorizationTest.testNoDescribeProduceOrConsumeWithoutTopicDescribeAcl`. Reviewers: Jason Gustafson<jason@confluent.io>, Rajini Sivaram <rajinisivaram@googlemail.com>
…7723) This patch fixes a bug in `SocketServer` in the expiration of connections which have not re-authenticated quickly enough. Previously these connections were left hanging, but now they are properly closed and cleaned up. This was one cause of the flaky test failures in `EndToEndAuthorizationTest.testNoDescribeProduceOrConsumeWithoutTopicDescribeAcl`. Reviewers: Jason Gustafson<jason@confluent.io>, Rajini Sivaram <rajinisivaram@googlemail.com>
…7723) This patch fixes a bug in `SocketServer` in the expiration of connections which have not re-authenticated quickly enough. Previously these connections were left hanging, but now they are properly closed and cleaned up. This was one cause of the flaky test failures in `EndToEndAuthorizationTest.testNoDescribeProduceOrConsumeWithoutTopicDescribeAcl`. Reviewers: Jason Gustafson<jason@confluent.io>, Rajini Sivaram <rajinisivaram@googlemail.com>
@hachikuji Here's the PR with two commits: one for the autoboxing/unboxing cleanup and the other for the close of the connection when an authentication session expires. You had originally suggested invoking
selector.close(channel.id)but I committedclose(channel.id)instead because that invokesselector.close()but also performs additional cleanup associated with the termination of a connection.