-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-23881 Ensure Netty client receives at least one response before… #1260
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
Conversation
|
This was a bear to figure out. This is only for Netty -- NIO works fine. This PR is also only valid for master -- due to the ZK-less MasterRegistry implementation. I think earlier 2.x branches will need custom patches. I'll pick those up after we're good on master. |
|
💔 -1 overall
This message was automatically generated. |
hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java
Show resolved
Hide resolved
hbase-client/src/main/java/org/apache/hadoop/hbase/security/NettyHBaseSaslRpcClientHandler.java
Show resolved
Hide resolved
|
OK, I checked the PlainClient, so the assumption here is that, client should have get at least one sasl response from server, even if it has reported as complete? But waht if later sasl client reports complete? Do we still need to wait for the server response? I'm a bit confused. |
|
🎊 +1 overall
This message was automatically generated. |
|
Think again, the end condition here should be:
Let me check the code again. Found a bug through a roughly looking... Where EMPTY_TOKEN is a byte[0], but in upper layer. we will check null to determine whether we have an initial response... |
|
🎊 +1 overall
This message was automatically generated. |
|
@joshelser If you do not mind, I plan to make a overall fix based on your patch and what's important, add more comments to say the rules here, to avoid further confusing of others. Thanks. |
Actually, I'd prefer to keep working on this, but am happy to work with you. I have a vested interest to make sure that, as we're looking at how HBase uses SASL, this is all translating well into the AuthenticationProvider stuff I've recently added into Master. My take is that the interfaces I added are lacking (given what we know about how other mechanisms work), but we could extend them and prevent other developers from making similar errors in the future. LMK. |
We could just make some AtomicBoolean, defaulting to false, which is changed to true after the first call to Do you think it's better to have an explicit check in the code rather than comments saying "don't re-add this"?
Will push a fix for this. Nice catch. I didn't notice that. |
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
bharathv
left a comment
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 chasing this down @joshelser. I have a couple of nits about the test but looks like the core of the fix is in the right direction. +1 to making the flow clear. I'm trying to wrap my head around the flow of the sasl handlers in the Netty code.
...a/org/apache/hadoop/hbase/security/provider/example/TestShadeSaslAuthenticationProvider.java
Outdated
Show resolved
Hide resolved
...a/org/apache/hadoop/hbase/security/provider/example/TestShadeSaslAuthenticationProvider.java
Show resolved
Hide resolved
Apache9
left a comment
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.
Please hold on, the implementation still has some problems. Will be back soon.
hbase-client/src/main/java/org/apache/hadoop/hbase/security/AbstractHBaseSaslRpcClient.java
Show resolved
Hide resolved
|
Sorry a bit busy these days. Will try to get sometime this weekendto review the patch more carefully. |
|
It's ok. I still owe you a fix-up of the re-introduction of |
Apache9
left a comment
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.
+1 after changing the getInitialResponse to return null when there is no initial response.
And reviewed the code, I think the blocking rpc client implementation has the same problem but due to the recent master based registry implementation, the blocking rpc client is just broken and can not be used anyway as it does not implement the createHedgedRpcChannel method...
Let's file another issue for fixing it, or we just remove the implementation, as it is not a good idea to leave a broken implementation in our code base.
|
Thanks Duo! I'll make the change, run it through QA and try to get this resolved in master. Removing sync impl for master seems right to me. I'll work on pulling this back to other branches after that. |
… considering SASL negotiation complete The PLAIN mechanism test added in the Shade authentication example has different semantics than GSSAPI mechanism -- the client reports that the handshake is done after the original challenge is computed. The javadoc on SaslClient, however, tells us that we need to wait for a response from the server before proceeding. The client, best as I can see, does not receive any data from HBase; however the application semantics (e.g. throw an exception on auth'n error) do not work as we intend as a result of this bug.
a0d7a67 to
92e9886
Compare
|
Rebased and fixed the last round of requests/suggestions from Bharath and Duo. I plan to commit to master and 2.x branches that this comes back cleanly to on QA. |
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
bharathv
left a comment
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.
Sorry for the delay, I was busy in the past few weeks. I finally had a chance to spend some time on this and it makes sense to me.
hbase-client/src/main/java/org/apache/hadoop/hbase/security/NettyHBaseSaslRpcClientHandler.java
Show resolved
Hide resolved
… considering SASL negotiation complete The PLAIN mechanism test added in the Shade authentication example has different semantics than GSSAPI mechanism -- the client reports that the handshake is done after the original challenge is computed. The javadoc on SaslClient, however, tells us that we need to wait for a response from the server before proceeding. The client, best as I can see, does not receive any data from HBase; however the application semantics (e.g. throw an exception on auth'n error) do not work as we intend as a result of this bug. Extra trace logging was also added to debug this, should a similar error ever happen again with some other mechanism. Closes apache#1260 Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Bharath Vissapragada <bharathv@apache.org>
… considering SASL negotiation complete The PLAIN mechanism test added in the Shade authentication example has different semantics than GSSAPI mechanism -- the client reports that the handshake is done after the original challenge is computed. The javadoc on SaslClient, however, tells us that we need to wait for a response from the server before proceeding. The client, best as I can see, does not receive any data from HBase; however the application semantics (e.g. throw an exception on auth'n error) do not work as we intend as a result of this bug. Extra trace logging was also added to debug this, should a similar error ever happen again with some other mechanism. Closes apache#1260 Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Bharath Vissapragada <bharathv@apache.org>
… considering SASL negotiation complete The PLAIN mechanism test added in the Shade authentication example has different semantics than GSSAPI mechanism -- the client reports that the handshake is done after the original challenge is computed. The javadoc on SaslClient, however, tells us that we need to wait for a response from the server before proceeding. The client, best as I can see, does not receive any data from HBase; however the application semantics (e.g. throw an exception on auth'n error) do not work as we intend as a result of this bug. Extra trace logging was also added to debug this, should a similar error ever happen again with some other mechanism. Closes apache#1260 Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Bharath Vissapragada <bharathv@apache.org>
… considering SASL negotiation complete The PLAIN mechanism test added in the Shade authentication example has different semantics than GSSAPI mechanism -- the client reports that the handshake is done after the original challenge is computed. The javadoc on SaslClient, however, tells us that we need to wait for a response from the server before proceeding. The client, best as I can see, does not receive any data from HBase; however the application semantics (e.g. throw an exception on auth'n error) do not work as we intend as a result of this bug. Extra trace logging was also added to debug this, should a similar error ever happen again with some other mechanism. Closes apache#1260 Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Bharath Vissapragada <bharathv@apache.org>
… considering SASL negotiation complete The PLAIN mechanism test added in the Shade authentication example has different semantics than GSSAPI mechanism -- the client reports that the handshake is done after the original challenge is computed. The javadoc on SaslClient, however, tells us that we need to wait for a response from the server before proceeding. The client, best as I can see, does not receive any data from HBase; however the application semantics (e.g. throw an exception on auth'n error) do not work as we intend as a result of this bug. Extra trace logging was also added to debug this, should a similar error ever happen again with some other mechanism. Closes #1260 Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Bharath Vissapragada <bharathv@apache.org>
… considering SASL negotiation complete
The PLAIN mechanism test added in the Shade authentication example has
different semantics than GSSAPI mechanism -- the client reports that the
handshake is done after the original challenge is computed. The javadoc
on SaslClient, however, tells us that we need to wait for a response
from the server before proceeding.
The client, best as I can see, does not receive any data from HBase;
however the application semantics (e.g. throw an exception on auth'n
error) do not work as we intend as a result of this bug.