diff --git a/.github/scripts/ensure_no_leak.sh b/.github/scripts/ensure_no_leak.sh new file mode 100755 index 000000000..6c6ebeead --- /dev/null +++ b/.github/scripts/ensure_no_leak.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# +# Copyright 2024 asyncer.io projects +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +set -e + +if [ "$#" -ne 1 ] || [ "${1##*.}" != "log" ]; then + echo "Please provide a single log file with a .log extension." + exit 1 +fi + +if grep -q 'LEAK' "$1" ; then + echo "LEAK FOUND: The log file $1 contains a memory leak." + exit 1 +fi + +echo "No Leak: The log file $1 does not contain any memory leaks." +exit 0 diff --git a/.github/workflows/ci-integration-tests.yml b/.github/workflows/ci-integration-tests.yml index 881d87903..16b0eadb1 100644 --- a/.github/workflows/ci-integration-tests.yml +++ b/.github/workflows/ci-integration-tests.yml @@ -33,4 +33,9 @@ jobs: -Dmaven.surefire.skip=true \ -Dtest.mysql.password=r2dbc-password!@ \ -Dtest.mysql.version=${{ matrix.mysql-version }} \ - -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN + -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN \ + -Dio.netty.leakDetectionLevel=paranoid \ + -Dio.netty.leakDetection.targetRecords=32 \ + | tee test.log + - name: ensure no leaks + run: ./.github/scripts/ensure_no_leak.sh test.log diff --git a/.github/workflows/ci-mariadb-intergration-tests.yml b/.github/workflows/ci-mariadb-intergration-tests.yml index 78d577d97..ee4841ac1 100644 --- a/.github/workflows/ci-mariadb-intergration-tests.yml +++ b/.github/workflows/ci-mariadb-intergration-tests.yml @@ -34,4 +34,10 @@ jobs: -Dtest.mysql.password=r2dbc-password!@ \ -Dtest.mysql.version=${{ matrix.mariadb-version }} \ -Dtest.db.type=mariadb \ - -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN + -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN \ + -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN \ + -Dio.netty.leakDetectionLevel=paranoid \ + -Dio.netty.leakDetection.targetRecords=32 \ + | tee test.log + - name: ensure no leaks + run: ./.github/scripts/ensure_no_leak.sh test.log diff --git a/.github/workflows/ci-unit-tests.yml b/.github/workflows/ci-unit-tests.yml index 694f30c1d..c5f87fe71 100644 --- a/.github/workflows/ci-unit-tests.yml +++ b/.github/workflows/ci-unit-tests.yml @@ -20,4 +20,10 @@ jobs: java-version: ${{ matrix.java-version }} cache: maven - name: Unit test with Maven - run: ./mvnw -B test -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN \ No newline at end of file + run: | + ./mvnw -B test -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN \ + -Dio.netty.leakDetectionLevel=paranoid \ + -Dio.netty.leakDetection.targetRecords=32 \ + | tee test.log + - name: ensure no leaks + run: ./.github/scripts/ensure_no_leak.sh test.log diff --git a/r2dbc-mysql/src/test/resources/logback-test.xml b/r2dbc-mysql/src/test/resources/logback-test.xml index c4aa3b8ab..591762720 100644 --- a/r2dbc-mysql/src/test/resources/logback-test.xml +++ b/r2dbc-mysql/src/test/resources/logback-test.xml @@ -26,6 +26,7 @@ +