Skip to content

HDFS-17869. QuorumJournalManager swallows root exception in catch blocks#8314

Open
balodesecurity wants to merge 1 commit intoapache:trunkfrom
balodesecurity:HDFS-17869
Open

HDFS-17869. QuorumJournalManager swallows root exception in catch blocks#8314
balodesecurity wants to merge 1 commit intoapache:trunkfrom
balodesecurity:HDFS-17869

Conversation

@balodesecurity
Copy link

Problem

In QuorumJournalManager, nine methods catch InterruptedException and TimeoutException and rethrow as IOException without chaining the original exception as the cause:

} catch (InterruptedException e) {
    throw new IOException("Interrupted waiting for format() response");
    //                                                               ^ no cause!
}

Affected methods: format, hasSomeData, doPreUpgrade, doUpgrade, doFinalize, canRollBack, doRollback, discardSegments, getJournalCTime.

When these exceptions surface in logs or are caught upstream, the original stack trace (and the interrupted thread's state) is lost entirely, making the root cause of failures invisible during debugging.

Fix

Pass the caught exception as the second argument to IOException(String, Throwable) in all 18 affected catch blocks, preserving the full exception chain.

Testing

  • Added TestQuorumJournalManagerUnit#testFormatTimeoutExceptionIsCauseChained: configures a QJM with a 50 ms operations timeout, makes all loggers return futures that never resolve, calls format(), and asserts that the thrown IOException has a TimeoutException as its cause.
  • Test passes locally.

@hadoop-yetus
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 7m 11s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 25m 43s trunk passed
+1 💚 compile 0m 59s trunk passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 compile 1m 0s trunk passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 checkstyle 1m 2s trunk passed
+1 💚 mvnsite 1m 3s trunk passed
+1 💚 javadoc 0m 51s trunk passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javadoc 0m 56s trunk passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 spotbugs 2m 18s trunk passed
+1 💚 shadedclient 17m 16s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 44s the patch passed
+1 💚 compile 0m 44s the patch passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javac 0m 44s the patch passed
+1 💚 compile 0m 44s the patch passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 javac 0m 44s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 41s the patch passed
+1 💚 mvnsite 0m 46s the patch passed
+1 💚 javadoc 0m 36s the patch passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javadoc 0m 36s the patch passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 spotbugs 2m 5s the patch passed
+1 💚 shadedclient 16m 12s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 180m 18s hadoop-hdfs in the patch passed.
+1 💚 asflicense 0m 30s The patch does not generate ASF License warnings.
261m 29s
Subsystem Report/Notes
Docker ClientAPI=1.54 ServerAPI=1.54 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8314/1/artifact/out/Dockerfile
GITHUB PR #8314
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 8bdf81322128 5.15.0-141-generic #151-Ubuntu SMP Sun May 18 21:35:19 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 417b8bf
Default Java Ubuntu-17.0.18+8-Ubuntu-124.04.1
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.10+7-Ubuntu-124.04 /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.18+8-Ubuntu-124.04.1
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8314/1/testReport/
Max. process+thread count 4695 (vs. ulimit of 5500)
modules C: hadoop-hdfs-project/hadoop-hdfs U: hadoop-hdfs-project/hadoop-hdfs
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8314/1/console
versions git=2.43.0 maven=3.9.11 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants