This is an automated email from the ASF dual-hosted git repository. maciej pushed a commit to branch java-byte-buf-mem-leak in repository https://gitbox.apache.org/repos/asf/iggy.git
commit 393cb8db8a123a51151dafe4961a00fde354d1f6 Author: Maciej Modzelewski <[email protected]> AuthorDate: Mon Feb 16 20:16:32 2026 +0100 fix(java): detect Netty ByteBuf memory leaks in CI tests The Java SDK uses Netty ByteBuf for network I/O, but leaks were not being caught during testing. Leaked buffers can cause OOM failures in long-running processes. Enable Netty's PARANOID leak detector in integration tests and add a CI step that scans test output for LEAK markers, failing the build if any are found. --- .github/actions/java-gradle/pre-merge/action.yml | 10 ++++++++++ .../test/java/org/apache/iggy/client/BaseIntegrationTest.java | 2 ++ 2 files changed, 12 insertions(+) diff --git a/.github/actions/java-gradle/pre-merge/action.yml b/.github/actions/java-gradle/pre-merge/action.yml index 7c76044f4..55f0bcf59 100644 --- a/.github/actions/java-gradle/pre-merge/action.yml +++ b/.github/actions/java-gradle/pre-merge/action.yml @@ -93,6 +93,16 @@ runs: USE_EXTERNAL_SERVER: true run: ./gradlew test + - name: Check for ByteBuf leaks + if: ${{ !cancelled() && inputs.task == 'test' }} + shell: bash + run: | + if grep -r "LEAK:" foreign/java/java-sdk/build/test-results/ 2>/dev/null; then + echo "::error::Netty ByteBuf memory leaks detected in test output!" + exit 1 + fi + echo "No ByteBuf leaks detected" + - name: Generate coverage report if: inputs.task == 'test' shell: bash diff --git a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/BaseIntegrationTest.java b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/BaseIntegrationTest.java index bc8d6d8c0..ad1d3f164 100644 --- a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/BaseIntegrationTest.java +++ b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/BaseIntegrationTest.java @@ -21,6 +21,7 @@ package org.apache.iggy.client; import com.github.dockerjava.api.model.Capability; import com.github.dockerjava.api.model.Ulimit; +import io.netty.util.ResourceLeakDetector; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.slf4j.Logger; @@ -55,6 +56,7 @@ public abstract class BaseIntegrationTest { @BeforeAll static void setupContainer() { + ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID); if (!USE_EXTERNAL_SERVER) { log.info("Starting Iggy Server Container..."); iggyServer = new GenericContainer<>(DockerImageName.parse("apache/iggy:edge"))
