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

HBASE-24579: Failed SASL authentication does not result in an exception on client side #1921

Merged
merged 2 commits into from
Jun 18, 2020

Conversation

BukrosSzabolcs
Copy link
Contributor

read input stream even if the authentication is completed
add a test

…on on client side

read input stream even if the auhentication is comleted
add a test
@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 30s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 17s master passed
+1 💚 compile 0m 28s master passed
+1 💚 shadedjars 5m 44s branch has no errors when building our shaded downstream artifacts.
-0 ⚠️ javadoc 0m 28s hbase-client in master failed.
_ Patch Compile Tests _
+1 💚 mvninstall 4m 4s the patch passed
+1 💚 compile 0m 29s the patch passed
+1 💚 javac 0m 30s the patch passed
+1 💚 shadedjars 5m 42s patch has no errors when building our shaded downstream artifacts.
-0 ⚠️ javadoc 0m 26s hbase-client in the patch failed.
_ Other Tests _
+1 💚 unit 1m 7s hbase-client in the patch passed.
24m 28s
Subsystem Report/Notes
Docker Client=19.03.11 Server=19.03.11 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/1/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #1921
JIRA Issue HBASE-24579
Optional Tests javac javadoc unit shadedjars compile
uname Linux 3fb9a0c4205e 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / b17ba7b
Default Java 2020-01-14
javadoc https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/1/artifact/yetus-jdk11-hadoop3-check/output/branch-javadoc-hbase-client.txt
javadoc https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/1/artifact/yetus-jdk11-hadoop3-check/output/patch-javadoc-hbase-client.txt
Test Results https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/1/testReport/
Max. process+thread count 296 (vs. ulimit of 12500)
modules C: hbase-client U: hbase-client
Console output https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/1/console
versions git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f)
Powered by Apache Yetus 0.11.1 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 22s Docker mode activated.
-0 ⚠️ yetus 0m 2s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 6s master passed
+1 💚 compile 0m 25s master passed
+1 💚 shadedjars 6m 4s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 24s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 52s the patch passed
+1 💚 compile 0m 29s the patch passed
+1 💚 javac 0m 29s the patch passed
+1 💚 shadedjars 6m 29s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 21s the patch passed
_ Other Tests _
+1 💚 unit 1m 16s hbase-client in the patch passed.
25m 55s
Subsystem Report/Notes
Docker Client=19.03.11 Server=19.03.11 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/1/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #1921
JIRA Issue HBASE-24579
Optional Tests javac javadoc unit shadedjars compile
uname Linux 5070546f1cb3 4.15.0-74-generic #84-Ubuntu SMP Thu Dec 19 08:06:28 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / b17ba7b
Default Java 1.8.0_232
Test Results https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/1/testReport/
Max. process+thread count 220 (vs. ulimit of 12500)
modules C: hbase-client U: hbase-client
Console output https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/1/console
versions git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f)
Powered by Apache Yetus 0.11.1 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 2s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+1 💚 mvninstall 4m 6s master passed
+1 💚 checkstyle 0m 30s master passed
+1 💚 spotbugs 1m 3s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 51s the patch passed
+1 💚 checkstyle 0m 31s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 12m 46s Patch does not cause any errors with Hadoop 3.1.2 3.2.1.
+1 💚 spotbugs 1m 13s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 12s The patch does not generate ASF License warnings.
32m 48s
Subsystem Report/Notes
Docker Client=19.03.11 Server=19.03.11 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #1921
JIRA Issue HBASE-24579
Optional Tests dupname asflicense spotbugs hadoopcheck hbaseanti checkstyle
uname Linux e19915c2afae 4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / b17ba7b
Max. process+thread count 84 (vs. ulimit of 12500)
modules C: hbase-client U: hbase-client
Console output https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/1/console
versions git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f) spotbugs=3.1.12
Powered by Apache Yetus 0.11.1 https://yetus.apache.org

This message was automatically generated.

Copy link
Contributor

@virajjasani virajjasani left a comment

Choose a reason for hiding this comment

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

Left few comments, please take a look

catch (Exception e){
if(e instanceof RemoteException){
LOG.debug("Sasl connection failed: ", e);
throw e;
Copy link
Contributor

@virajjasani virajjasani Jun 17, 2020

Choose a reason for hiding this comment

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

This should be out of if condition right? Don't we want to re-throw IOException other than RemoteException?
Which brings the question, why to even have if condition? I know RemoteException coming from readStatus is imp to us but we don't want to swallow IOException if inStream.readInt() throws one because inStream.readInt() is pre-requisite to know whether the status is SaslStatus.SUCCESS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, the if condition is not necessary, I'll fix that.
As far as I understand SaslStatus.SUCCESS should have been handled at this point and having no new data in the stream is a valid usecase. If we would re-throw IOExceptions we would re-throw the EOFException we would get when trying to read from such a stream.

…on on client side

remove if condition
only catch IOExceptions
@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 4s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 5s master passed
+1 💚 compile 0m 25s master passed
+1 💚 shadedjars 6m 7s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 24s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 46s the patch passed
+1 💚 compile 0m 24s the patch passed
+1 💚 javac 0m 24s the patch passed
+1 💚 shadedjars 6m 3s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 21s the patch passed
_ Other Tests _
+1 💚 unit 1m 13s hbase-client in the patch passed.
24m 57s
Subsystem Report/Notes
Docker Client=19.03.11 Server=19.03.11 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/2/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #1921
JIRA Issue HBASE-24579
Optional Tests javac javadoc unit shadedjars compile
uname Linux ab96766f3b19 4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 192dade
Default Java 1.8.0_232
Test Results https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/2/testReport/
Max. process+thread count 219 (vs. ulimit of 12500)
modules C: hbase-client U: hbase-client
Console output https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/2/console
versions git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f)
Powered by Apache Yetus 0.11.1 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 24s Docker mode activated.
-0 ⚠️ yetus 0m 2s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 52s master passed
+1 💚 compile 0m 29s master passed
+1 💚 shadedjars 6m 31s branch has no errors when building our shaded downstream artifacts.
-0 ⚠️ javadoc 0m 26s hbase-client in master failed.
_ Patch Compile Tests _
+1 💚 mvninstall 4m 31s the patch passed
+1 💚 compile 0m 28s the patch passed
+1 💚 javac 0m 28s the patch passed
+1 💚 shadedjars 6m 28s patch has no errors when building our shaded downstream artifacts.
-0 ⚠️ javadoc 0m 25s hbase-client in the patch failed.
_ Other Tests _
+1 💚 unit 1m 25s hbase-client in the patch passed.
28m 10s
Subsystem Report/Notes
Docker Client=19.03.11 Server=19.03.11 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/2/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #1921
JIRA Issue HBASE-24579
Optional Tests javac javadoc unit shadedjars compile
uname Linux 02c70559fc1d 4.15.0-74-generic #84-Ubuntu SMP Thu Dec 19 08:06:28 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 192dade
Default Java 2020-01-14
javadoc https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/2/artifact/yetus-jdk11-hadoop3-check/output/branch-javadoc-hbase-client.txt
javadoc https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/2/artifact/yetus-jdk11-hadoop3-check/output/patch-javadoc-hbase-client.txt
Test Results https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/2/testReport/
Max. process+thread count 200 (vs. ulimit of 12500)
modules C: hbase-client U: hbase-client
Console output https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/2/console
versions git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f)
Powered by Apache Yetus 0.11.1 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 28s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+1 💚 mvninstall 3m 47s master passed
+1 💚 checkstyle 0m 29s master passed
+1 💚 spotbugs 1m 0s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 18s the patch passed
+1 💚 checkstyle 0m 28s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 11m 12s Patch does not cause any errors with Hadoop 3.1.2 3.2.1.
+1 💚 spotbugs 1m 9s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 15s The patch does not generate ASF License warnings.
29m 11s
Subsystem Report/Notes
Docker Client=19.03.11 Server=19.03.11 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/2/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #1921
JIRA Issue HBASE-24579
Optional Tests dupname asflicense spotbugs hadoopcheck hbaseanti checkstyle
uname Linux 4c9ade9256a7 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 16:55:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 192dade
Max. process+thread count 94 (vs. ulimit of 12500)
modules C: hbase-client U: hbase-client
Console output https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1921/2/console
versions git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f) spotbugs=3.1.12
Powered by Apache Yetus 0.11.1 https://yetus.apache.org

This message was automatically generated.

readStatus(inStream);
}
catch (IOException e){
if(e instanceof RemoteException){
Copy link
Contributor

@virajjasani virajjasani Jun 17, 2020

Choose a reason for hiding this comment

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

We still have this condition? I was talking about removing this condition because with this condition, we are swallowing IOException other than RemoteException, which we don't want to do. We want to re-throw all categories of IOException here, not just RemoteException.

Copy link
Contributor

@virajjasani virajjasani Jun 17, 2020

Choose a reason for hiding this comment

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

I think you removed the outer condition instead of
if(e instanceof RemoteException).
Let me copy my previous comment:

I know RemoteException coming from readStatus is imp to us but we don't want to swallow IOException if inStream.readInt() throws one because inStream.readInt() is pre-requisite to know whether the status is SaslStatus.SUCCESS

I am talking about what is happening within readStatus(inStream) call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just run a test on a test system. This time authentication was set up correctly and the goal was to see what happens in a normal usecase.
When it reached the new readStatus(inStream); The following exception was thrown:

java.net.SocketTimeoutException: 20000 millis timeout while waiting for channel to be ready for read. ch : java.nio.channels.SocketChannel[connected local=/xxx remote=yyy ]
        at org.apache.hadoop.net.SocketIOWithTimeout.doIO(SocketIOWithTimeout.java:164)
        at org.apache.hadoop.net.SocketInputStream.read(SocketInputStream.java:161)
        at org.apache.hadoop.net.SocketInputStream.read(SocketInputStream.java:131)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
        at java.io.DataInputStream.readInt(DataInputStream.java:387)
        at org.apache.hadoop.hbase.security.HBaseSaslRpcClient.readStatus(HBaseSaslRpcClient.java:51)

This is an IOException. This is exactly the kind of exception that we do not want to re-throw, because it is caused by the additional readStatus and would not exist otherwise. The line if(e instanceof RemoteException) is there to filter out exceptions like this.

Copy link
Contributor

@virajjasani virajjasani Jun 18, 2020

Choose a reason for hiding this comment

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

Thanks @BukrosSzabolcs for the explanation. Got your point.

Copy link
Contributor

@virajjasani virajjasani left a comment

Choose a reason for hiding this comment

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

+1

@wchevreuil wchevreuil merged commit bd79c40 into apache:master Jun 18, 2020
wchevreuil pushed a commit that referenced this pull request Jun 18, 2020
…on on client side (#1921)

Signed-off-by: Wellington Chevreuil <[email protected]>
Signed-off-by: Viraj Jasani <[email protected]>
(cherry picked from commit bd79c40)
wchevreuil pushed a commit that referenced this pull request Jun 19, 2020
…on on client side (#1921)

Signed-off-by: Wellington Chevreuil <[email protected]>
Signed-off-by: Viraj Jasani <[email protected]>
(cherry picked from commit bd79c40)
BukrosSzabolcs added a commit to BukrosSzabolcs/hbase that referenced this pull request Jun 22, 2020
…on on client side (apache#1921)

Signed-off-by: Wellington Chevreuil <[email protected]>
Signed-off-by: Viraj Jasani <[email protected]>
clarax pushed a commit to clarax/hbase that referenced this pull request Nov 15, 2020
…on on client side (apache#1921)

Signed-off-by: Wellington Chevreuil <[email protected]>
Signed-off-by: Viraj Jasani <[email protected]>
(cherry picked from commit bd79c40)
apurtell added a commit to apurtell/hbase that referenced this pull request Jul 22, 2022
…nabled after finishing negotiation

Revert "HBASE-24579: Failed SASL authentication does not result in an exception on client side (apache#1921)"

This reverts commit bd79c40.

When Kerberos authentication succeeds, on the server side, after
receiving the final SASL token from the client, we simply wait for
the client to continue by sending the connection header.
After HBASE-24579, on the client side, an additional readStatus()
was added, which mistakenly assumes that after negotiation has
completed a status code will be sent. However when authentication
has succeeded the server will not send one. As a result the client
will hang and only throw an exception when the configured read
timeout is reached, which is 20 seconds by default.

We cannot unilaterally send the expected additional status code
from the server side because older clients will not expect it. The
first call will fail because the client finds unexpected bytes in
the stream ahead of the call response. Fabricating a call response
also does not seem a viable strategy for backwards compatibility.

The HBASE-24579 change needs to be reconsidered given the
difficult backwards compatibility challenges here.
apurtell added a commit that referenced this pull request Jul 25, 2022
…nabled after finishing negotiation (#4642)

Revert "HBASE-24579: Failed SASL authentication does not result in an exception on client side (#1921)"

This reverts commit bd79c40.

When Kerberos authentication succeeds, on the server side, after
receiving the final SASL token from the client, we simply wait for
the client to continue by sending the connection header.
After HBASE-24579, on the client side, an additional readStatus()
was added, which mistakenly assumes that after negotiation has
completed a status code will be sent. However when authentication
has succeeded the server will not send one. As a result the client
will hang and only throw an exception when the configured read
timeout is reached, which is 20 seconds by default.

We cannot unilaterally send the expected additional status code
from the server side because older clients will not expect it. The
first call will fail because the client finds unexpected bytes in
the stream ahead of the call response. Fabricating a call response
also does not seem a viable strategy for backwards compatibility.

The HBASE-24579 change needs to be reconsidered given the
difficult backwards compatibility challenges here.

Signed-off-by: Duo Zhang <[email protected]>
Signed-off-by: Viraj Jasani <[email protected]>
asfgit pushed a commit that referenced this pull request Jul 25, 2022
…nabled after finishing negotiation (#4642)

Revert "HBASE-24579: Failed SASL authentication does not result in an exception on client side (#1921)"

This reverts commit bd79c40.

When Kerberos authentication succeeds, on the server side, after
receiving the final SASL token from the client, we simply wait for
the client to continue by sending the connection header.
After HBASE-24579, on the client side, an additional readStatus()
was added, which mistakenly assumes that after negotiation has
completed a status code will be sent. However when authentication
has succeeded the server will not send one. As a result the client
will hang and only throw an exception when the configured read
timeout is reached, which is 20 seconds by default.

We cannot unilaterally send the expected additional status code
from the server side because older clients will not expect it. The
first call will fail because the client finds unexpected bytes in
the stream ahead of the call response. Fabricating a call response
also does not seem a viable strategy for backwards compatibility.

The HBASE-24579 change needs to be reconsidered given the
difficult backwards compatibility challenges here.

Signed-off-by: Duo Zhang <[email protected]>
Signed-off-by: Viraj Jasani <[email protected]>
asfgit pushed a commit that referenced this pull request Jul 25, 2022
…nabled after finishing negotiation (#4642)

Revert "HBASE-24579: Failed SASL authentication does not result in an exception on client side (#1921)"

This reverts commit bd79c40.

When Kerberos authentication succeeds, on the server side, after
receiving the final SASL token from the client, we simply wait for
the client to continue by sending the connection header.
After HBASE-24579, on the client side, an additional readStatus()
was added, which mistakenly assumes that after negotiation has
completed a status code will be sent. However when authentication
has succeeded the server will not send one. As a result the client
will hang and only throw an exception when the configured read
timeout is reached, which is 20 seconds by default.

We cannot unilaterally send the expected additional status code
from the server side because older clients will not expect it. The
first call will fail because the client finds unexpected bytes in
the stream ahead of the call response. Fabricating a call response
also does not seem a viable strategy for backwards compatibility.

The HBASE-24579 change needs to be reconsidered given the
difficult backwards compatibility challenges here.

Signed-off-by: Duo Zhang <[email protected]>
Signed-off-by: Viraj Jasani <[email protected]>

Conflicts:
	hbase-client/src/test/java/org/apache/hadoop/hbase/security/TestHBaseSaslRpcClient.java
asfgit pushed a commit that referenced this pull request Jul 25, 2022
…nabled after finishing negotiation (#4642)

Revert "HBASE-24579: Failed SASL authentication does not result in an exception on client side (#1921)"

This reverts commit bd79c40.

When Kerberos authentication succeeds, on the server side, after
receiving the final SASL token from the client, we simply wait for
the client to continue by sending the connection header.
After HBASE-24579, on the client side, an additional readStatus()
was added, which mistakenly assumes that after negotiation has
completed a status code will be sent. However when authentication
has succeeded the server will not send one. As a result the client
will hang and only throw an exception when the configured read
timeout is reached, which is 20 seconds by default.

We cannot unilaterally send the expected additional status code
from the server side because older clients will not expect it. The
first call will fail because the client finds unexpected bytes in
the stream ahead of the call response. Fabricating a call response
also does not seem a viable strategy for backwards compatibility.

The HBASE-24579 change needs to be reconsidered given the
difficult backwards compatibility challenges here.

Signed-off-by: Duo Zhang <[email protected]>
Signed-off-by: Viraj Jasani <[email protected]>
vinayakphegde pushed a commit to vinayakphegde/hbase that referenced this pull request Apr 4, 2024
…nabled after finishing negotiation (apache#4642)

Revert "HBASE-24579: Failed SASL authentication does not result in an exception on client side (apache#1921)"

This reverts commit bd79c40.

When Kerberos authentication succeeds, on the server side, after
receiving the final SASL token from the client, we simply wait for
the client to continue by sending the connection header.
After HBASE-24579, on the client side, an additional readStatus()
was added, which mistakenly assumes that after negotiation has
completed a status code will be sent. However when authentication
has succeeded the server will not send one. As a result the client
will hang and only throw an exception when the configured read
timeout is reached, which is 20 seconds by default.

We cannot unilaterally send the expected additional status code
from the server side because older clients will not expect it. The
first call will fail because the client finds unexpected bytes in
the stream ahead of the call response. Fabricating a call response
also does not seem a viable strategy for backwards compatibility.

The HBASE-24579 change needs to be reconsidered given the
difficult backwards compatibility challenges here.

Signed-off-by: Duo Zhang <[email protected]>
Signed-off-by: Viraj Jasani <[email protected]>

Conflicts: hbase-client/src/test/java/org/apache/hadoop/hbase/security/TestHBaseSaslRpcClient.java
(cherry picked from commit 33b3bbe)
Change-Id: I52e69e0e72e158f90868156291a15324ee7aaf3c
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.

4 participants