[ 
https://issues.apache.org/jira/browse/HADOOP-18814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18099695#comment-18099695
 ] 

ASF GitHub Bot commented on HADOOP-18814:
-----------------------------------------

hadoop-yetus commented on PR #8636:
URL: https://github.com/apache/hadoop/pull/8636#issuecomment-5103337348

   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime |  Logfile | Comment |
   |:----:|----------:|--------:|:--------:|:-------:|
   | +0 :ok: |  reexec  |  19m  4s |  |  Docker mode activated.  |
   |||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  |  No case conflicting files 
found.  |
   | +0 :ok: |  codespell  |   0m  0s |  |  codespell was not available.  |
   | +0 :ok: |  detsecrets  |   0m  0s |  |  detect-secrets was not available.  
|
   | +1 :green_heart: |  @author  |   0m  0s |  |  The patch does not contain 
any @author tags.  |
   | +1 :green_heart: |  test4tests  |   0m  0s |  |  The patch appears to 
include 1 new or modified test files.  |
   |||| _ trunk Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |  46m 38s |  |  trunk passed  |
   | +1 :green_heart: |  compile  |  17m 39s |  |  trunk passed with JDK 
Ubuntu-21.0.11+10-1-24.04.2-Ubuntu  |
   | +1 :green_heart: |  compile  |  18m 17s |  |  trunk passed with JDK 
Ubuntu-17.0.19+10-1-24.04.2-Ubuntu  |
   | +1 :green_heart: |  checkstyle  |   1m 32s |  |  trunk passed  |
   | +1 :green_heart: |  mvnsite  |   1m 58s |  |  trunk passed  |
   | +1 :green_heart: |  javadoc  |   1m 26s |  |  trunk passed with JDK 
Ubuntu-21.0.11+10-1-24.04.2-Ubuntu  |
   | +1 :green_heart: |  javadoc  |   1m 22s |  |  trunk passed with JDK 
Ubuntu-17.0.19+10-1-24.04.2-Ubuntu  |
   | +1 :green_heart: |  spotbugs  |   3m 13s |  |  trunk passed  |
   | +1 :green_heart: |  shadedclient  |  36m 54s |  |  branch has no errors 
when building and testing our client artifacts.  |
   |||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   1m 15s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |  16m 49s |  |  the patch passed with JDK 
Ubuntu-21.0.11+10-1-24.04.2-Ubuntu  |
   | +1 :green_heart: |  javac  |  16m 49s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |  18m  2s |  |  the patch passed with JDK 
Ubuntu-17.0.19+10-1-24.04.2-Ubuntu  |
   | +1 :green_heart: |  javac  |  18m  2s |  |  the patch passed  |
   | +1 :green_heart: |  blanks  |   0m  0s |  |  The patch has no blanks 
issues.  |
   | +1 :green_heart: |  checkstyle  |   1m 27s |  |  the patch passed  |
   | +1 :green_heart: |  mvnsite  |   1m 56s |  |  the patch passed  |
   | +1 :green_heart: |  javadoc  |   1m 22s |  |  the patch passed with JDK 
Ubuntu-21.0.11+10-1-24.04.2-Ubuntu  |
   | +1 :green_heart: |  javadoc  |   1m 22s |  |  the patch passed with JDK 
Ubuntu-17.0.19+10-1-24.04.2-Ubuntu  |
   | +1 :green_heart: |  spotbugs  |   3m 23s |  |  the patch passed  |
   | +1 :green_heart: |  shadedclient  |  36m 54s |  |  patch has no errors 
when building and testing our client artifacts.  |
   |||| _ Other Tests _ |
   | +1 :green_heart: |  unit  |  23m 35s |  |  hadoop-common in the patch 
passed.  |
   | +1 :green_heart: |  asflicense  |   1m 13s |  |  The patch does not 
generate ASF License warnings.  |
   |  |   | 256m 49s |  |  |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | ClientAPI=1.55 ServerAPI=1.55 base: 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8636/1/artifact/out/Dockerfile
 |
   | GITHUB PR | https://github.com/apache/hadoop/pull/8636 |
   | Optional Tests | dupname asflicense compile javac javadoc mvninstall 
mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets |
   | uname | Linux 2143aefbcfea 5.15.0-181-generic #191-Ubuntu SMP Fri May 22 
19:09:02 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/bin/hadoop.sh |
   | git revision | trunk / 969a0950ff87907fb27a96392cf3c93ad8dcbb9d |
   | Default Java | Ubuntu-17.0.19+10-1-24.04.2-Ubuntu |
   | Multi-JDK versions | 
/usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.11+10-1-24.04.2-Ubuntu 
/usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.19+10-1-24.04.2-Ubuntu |
   |  Test Results | 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8636/1/testReport/ |
   | Max. process+thread count | 1284 (vs. ulimit of 10000) |
   | modules | C: hadoop-common-project/hadoop-common U: 
hadoop-common-project/hadoop-common |
   | Console output | 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8636/1/console |
   | versions | git=2.43.0 maven=3.9.15 spotbugs=4.9.7 |
   | Powered by | Apache Yetus 0.14.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   




> Direct class cast causes ClassCastException in TestRPC#testReaderExceptions
> ---------------------------------------------------------------------------
>
>                 Key: HADOOP-18814
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18814
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: conf, ipc
>            Reporter: rstest
>            Priority: Critical
>              Labels: pull-request-available
>         Attachments: reproduce.sh
>
>
> h2. What happened:
> Test {{TestRPC#testReaderExceptions}} assumes there is a RemoteException has 
> been thrown and directly cast the root cause of {{ServiceException}} to 
> {{{}RemoteException{}}}. But this cast may lead to ClassCastException when 
> the root cause exception is not {{{}RemoteException{}}}.
> h2. Buggy code:
> {code:java}
> @Test (timeout=30000)
> public void testReaderExceptions() throws Exception {
>       ...
>       try {
>         FakeRequestClass.exception = doDisconnect ? rseFatal : rseError;
>         proxy.ping(null, newEmptyRequest());
>         fail(reqName + " didn't fail");
>       } catch (ServiceException e) {
>         RemoteException re = (RemoteException)e.getCause();       // <--- 
> Here the test assumes the root cause is RemoteException
>         assertEquals(reqName, expectedIOE, re.unwrapRemoteException());
>       } {code}
> h2. How to reproduce:
> (1) Set {{hadoop.security.authentication}} to {{kerberos}}
> (2) Run test {{TestRPC#testReaderExceptions}}
> h2. Stack trace:
> {code:java}
> java.lang.ClassCastException: class java.io.IOException cannot be cast to 
> class org.apache.hadoop.ipc.RemoteException (java.io.IOException is in module 
> java.base of loader 'bootstrap'; org.apache.had
> oop.ipc.RemoteException is in unnamed module of loader 'app')                 
>  
>         at 
> org.apache.hadoop.ipc.TestRPC.testReaderExceptions(TestRPC.java:1742)         
>                                                                               
>                                 
>         at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.base/java.lang.reflect.Method.invoke(Method.java:566)         
>                      
>         at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
>         at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>      
>         at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
>         at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>         at 
> org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299)
>         at 
> org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293)
>                                                                               
>             
>         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) 
>                      
>         at java.base/java.lang.Thread.run(Thread.java:829)   {code}
> h2. Fix:
> A better way to do is to firstly check whether the root cause is 
> RemoteException, if not, fail the test rather than causing the 
> CastClassException:
> {code:java}
>   try {
>     FakeRequestClass.exception = doDisconnect ? rseFatal : rseError;
>     proxy.ping(null, newEmptyRequest());
>     fail(reqName + " didn't fail");
>   } catch (ServiceException e) {
>     if (e.getCause() instanceof RemoteException) {
>       RemoteException re = (RemoteException)e.getCause();
>       assertEquals(reqName, expectedIOE, re.unwrapRemoteException());
>     } else {
>       fail(reqName + " didn't fail with RemoteException");
>     }
>   } {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to