Skip to content
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

Implement authentication long polling #9149

Merged
merged 9 commits into from May 30, 2019
Merged

Conversation

ggezer
Copy link
Contributor

@ggezer ggezer commented May 28, 2019

AuthenticationServer has a setting for revoking authentication after a period of inactivity. To handle that on the client side, metadata clients, after a period of inactivity, will retry after getting Unauthenticated code. However, due to nature of streaming, data clients can not retry after getting the error because they might have pipelined more data before seeing the error. And since this revocation will not change the connection state, they used to continue getting Unauthenticated. See #9089 for an instance of this problem.

This PR introduces long polling to authentication handshake. Client and server will not complete streams used for authentication and instead will use it for notifying end of an authentication session. With this change, revocation on server will be propagated to client channel via health status, causing a client recreation for later use of the same channel. Also client closing the channel will notify server and it'll clean its state of the recently closed channel.

Periodic cleanup has not been disabled in order to not prolong a duration for a channel to remain authenticated.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Alluxio-Pull-Request-Builder/3881/
Test PASSed.

Copy link
Contributor

@gpang gpang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ggezer Thanks! I left some comments.

@@ -51,6 +52,11 @@ public GrpcChannel(GrpcManagedChannelPool.ChannelKey channelKey, Channel channel
mChannelHealthState = channel instanceof AuthenticatedChannel
? () -> (((AuthenticatedChannel) channel).isAuthenticated() && mChannelHealthy)
: () -> mChannelHealthy;
if (channel instanceof AuthenticatedChannel) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do various things for the instance of AuthenticatedChannel. Can we just have a bool for that?

Also, what other types of channels (not AuthenticatedChannel) are possible? All this checking looks like it can be abstracted away.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Channel is not our class so can't replace AuthenticatedChannel with a boolean. I did some changes for better abstracting the authenticated channel handling.

* @return the authentication server associated with this server
*/
@VisibleForTesting
public AuthenticationServer getAuthenticationServer() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't the test just pass in the authentication server?

Copy link
Contributor Author

@ggezer ggezer May 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GrpcServer is built by ServerBuilder which dynamically creates the auth server. Removing this method would mean adding a new method to builder with a slightly more complex code.

@@ -41,20 +42,24 @@
private SaslHandshakeClientHandler mSaslHandshakeClientHandler;
/** Used to wait until authentication is completed. */
private SettableFuture<Boolean> mAuthenticated;
/** Whether the authentication is active. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add comments on how this is different from mAuthenticated and how they interact? Are both required? Having both is very confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SettableFuture is unfortunately not resettable, so it can't be used to reflect state changes following the initial state. I changed names and comments to try to make it less confusing.

@ggezer
Copy link
Contributor Author

ggezer commented May 28, 2019

@gpang Updated PR after your feedback. PTAL.

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Alluxio-Pull-Request-Builder/3886/
Test FAILed.

Copy link
Contributor

@gpang gpang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ggezer Left some minor comments.

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Alluxio-Pull-Request-Builder/3887/
Test FAILed.

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Alluxio-Pull-Request-Builder/3908/
Test FAILed.

@gpang
Copy link
Contributor

gpang commented May 29, 2019

jenkins, test this please

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Alluxio-Pull-Request-Builder/3950/
Test FAILed.

@gpang
Copy link
Contributor

gpang commented May 29, 2019

Jenkins, test this please

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Alluxio-Pull-Request-Builder/3960/
Test FAILed.

@gpang
Copy link
Contributor

gpang commented May 29, 2019

Jenkins, test this please

@gpang
Copy link
Contributor

gpang commented May 29, 2019

@ggezer I think this looks good, but the tests keep failing

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Alluxio-Pull-Request-Builder/3963/
Test FAILed.

Copy link
Contributor

@bf8086 bf8086 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. I left some minor comments inline.

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Alluxio-Pull-Request-Builder/3968/
Test FAILed.

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Alluxio-Pull-Request-Builder/3978/
Test FAILed.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Alluxio-Pull-Request-Builder/3979/
Test PASSed.

Copy link
Contributor

@bf8086 bf8086 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the fix!

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Alluxio-Pull-Request-Builder/3994/
Test FAILed.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Alluxio-Pull-Request-Builder/3999/
Test PASSed.

Copy link
Contributor

@gpang gpang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gpang
Copy link
Contributor

gpang commented May 30, 2019

alluxio-bot, merge this please

@alluxio-bot alluxio-bot merged commit db93814 into Alluxio:master May 30, 2019
@bf8086
Copy link
Contributor

bf8086 commented Jun 3, 2019

@gpang Can you help cherry-pick this PR to 2.0 branch?

@calvinjia
Copy link
Contributor

alluxio-bot, cherry-pick this to branch-2.0 please.

@alluxio-bot
Copy link
Contributor

Auto cherry-pick successful to branch: branch-2.0

alluxio-bot pushed a commit that referenced this pull request Jun 3, 2019
Auto cherry-pick of existing commit.
orig-pr: #9149
orig-commit: db93814
orig-commit-author: Göktürk Gezer <gokturk@alluxio.com>

pr-link: #9149
change-id: cid-7c847b674046f4836c2d77881d47985a760b8951
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants