Skip to content

HADOOP-19255. Update io.compression.codec.lzo.buffersize to 262144#8601

Open
anshuksi282-ksolves wants to merge 2 commits into
apache:trunkfrom
anshuksi282-ksolves:HADOOP-19255
Open

HADOOP-19255. Update io.compression.codec.lzo.buffersize to 262144#8601
anshuksi282-ksolves wants to merge 2 commits into
apache:trunkfrom
anshuksi282-ksolves:HADOOP-19255

Conversation

@anshuksi282-ksolves

Copy link
Copy Markdown

Description of PR

This PR fixes HADOOP-18896.

The buffer size in FSOutputSummer is computed as sum.getBytesPerChecksum() * BUFFER_NUM_CHUNKS. When file.bytes-per-checksum is configured to a very large value (e.g. 238609295), this multiplication overflows a signed 32-bit int and wraps around to a negative number, causing a NegativeArraySizeException when allocating the internal buffer array.

This PR adds a Preconditions.checkArgument check in the FSOutputSummer constructor to validate that the computed buffer size is positive, failing fast with a clear IllegalArgumentException instead of an obscure NegativeArraySizeException.

This continues the work started in #6064 by @teamconfx, which went stale. This PR additionally adds a unit test as requested in that PR's review (test4tests check had failed on the original PR).

How was this patch tested?

  • Added a new test class TestFSOutputSummer in hadoop-common with testLargeBytesPerChecksumOverflow, using a minimal concrete subclass of FSOutputSummer to verify the constructor fails with IllegalArgumentException (rather than NegativeArraySizeException) when bytesPerChecksum * BUFFER_NUM_CHUNKS overflows.
  • Verified the test fails with the original NegativeArraySizeException when the fix is reverted, and passes with the fix applied.
  • mvn -pl hadoop-common-project/hadoop-common test -Dtest=TestFSOutputSummer passes.

Note: the JIRA's original reproduction steps reference an HDFS test (TestDecommissionWithStriped), but since the buffer overflow bug lives entirely in hadoop-common's FSOutputSummer class, this PR adds a focused unit test in hadoop-common instead, avoiding an unnecessary cross-module HDFS test dependency.

AI Tooling

Contains content generated by Claude (Anthropic). Used to help investigate the root cause, draft the fix, and write/verify the accompanying unit test.

@anshuksi282-ksolves

Copy link
Copy Markdown
Author

Hi @ayushtkn @dineshchitlangia, thank you for reviewing #7009 earlier. I'm new to contributing to Hadoop and have picked this issue up since the original PR went stale.

I've addressed the feedback from that PR:

  • Added a unit test (TestCodec#testLzoBufferSizeDefault) verifying the corrected default, as requested by @brahmareddybattula.
  • Clarified in the description why this restores the pre-existing hadoop-lzo native default (256KB) rather than changing an established one, per @ayushtkn's earlier comment.

Would appreciate your review whenever you get a chance. Happy to make any further changes needed.

@hadoop-yetus

Copy link
Copy Markdown

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 21s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 1s codespell was not available.
+0 🆗 detsecrets 0m 1s detect-secrets was not available.
+0 🆗 xmllint 0m 1s xmllint 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 47s trunk passed
+1 💚 compile 8m 29s trunk passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 compile 8m 51s trunk passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 checkstyle 0m 56s trunk passed
+1 💚 mvnsite 1m 12s trunk passed
+1 💚 javadoc 0m 56s trunk passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 javadoc 0m 52s trunk passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 spotbugs 1m 48s trunk passed
+1 💚 shadedclient 16m 51s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 40s the patch passed
+1 💚 compile 8m 10s the patch passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 javac 8m 10s the patch passed
+1 💚 compile 8m 45s the patch passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 javac 8m 45s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
-0 ⚠️ checkstyle 0m 49s /results-checkstyle-hadoop-common-project_hadoop-common.txt hadoop-common-project/hadoop-common: The patch generated 2 new + 120 unchanged - 1 fixed = 122 total (was 121)
+1 💚 mvnsite 1m 8s the patch passed
+1 💚 javadoc 0m 50s the patch passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 javadoc 0m 53s the patch passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 spotbugs 1m 49s the patch passed
+1 💚 shadedclient 17m 4s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 18m 20s hadoop-common in the patch passed.
+1 💚 asflicense 0m 48s The patch does not generate ASF License warnings.
126m 40s
Subsystem Report/Notes
Docker ClientAPI=1.55 ServerAPI=1.55 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8601/2/artifact/out/Dockerfile
GITHUB PR #8601
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets xmllint
uname Linux f5e346d68f20 5.15.0-179-generic #189-Ubuntu SMP Tue May 5 18:20:56 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / d617fcc
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-8601/2/testReport/
Max. process+thread count 3160 (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-8601/2/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.

@hadoop-yetus

Copy link
Copy Markdown

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 19m 54s 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.
+0 🆗 xmllint 0m 0s xmllint 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 47m 12s trunk passed
+1 💚 compile 17m 54s trunk passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 compile 18m 10s trunk passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 checkstyle 1m 28s trunk passed
+1 💚 mvnsite 2m 0s trunk passed
+1 💚 javadoc 1m 25s trunk passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 javadoc 1m 21s trunk passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 spotbugs 3m 10s trunk passed
+1 💚 shadedclient 37m 1s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 1m 16s the patch passed
+1 💚 compile 16m 37s the patch passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 javac 16m 37s the patch passed
+1 💚 compile 18m 6s the patch passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 javac 18m 6s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
-0 ⚠️ checkstyle 1m 25s /results-checkstyle-hadoop-common-project_hadoop-common.txt hadoop-common-project/hadoop-common: The patch generated 2 new + 120 unchanged - 1 fixed = 122 total (was 121)
+1 💚 mvnsite 1m 59s the patch passed
+1 💚 javadoc 1m 22s the patch passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 javadoc 1m 22s the patch passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 spotbugs 3m 20s the patch passed
+1 💚 shadedclient 37m 1s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 23m 32s hadoop-common in the patch passed.
+1 💚 asflicense 1m 14s The patch does not generate ASF License warnings.
258m 18s
Subsystem Report/Notes
Docker ClientAPI=1.55 ServerAPI=1.55 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8601/1/artifact/out/Dockerfile
GITHUB PR #8601
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets xmllint
uname Linux 3e1e5d55c5bd 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 / d617fcc
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-8601/1/testReport/
Max. process+thread count 3145 (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-8601/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.

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.

2 participants