Skip to content

[fix][test] Restore NETTY_LEAK_DETECTION for Gradle and CI tests - #26605

Merged
lhotari merged 5 commits into
apache:masterfrom
lhotari:restore-netty-leak-detection
Sep 17, 2026
Merged

lhotari merged 5 commits into
apache:masterfrom
lhotari:restore-netty-leak-detection

Conversation

@lhotari

@lhotari lhotari commented Sep 16, 2026

Copy link
Copy Markdown
Member

Motivation

The Gradle migration dropped the test JVM settings that enabled NETTY_LEAK_DETECTION in branch-4.2. The CI controls and custom detector remained, but tests no longer used the detector by default. Integration and system jobs also lost their leak-report collection steps.

Container logs were copied before graceful service shutdown, so leak reports produced by the detector's JVM shutdown hook could be lost when the container was removed.

Modifications

  • Restore ExtendedNettyLeakDetector and paranoid detection for Gradle tests, including NETTY_LEAK_DETECTION=off, leak-level and exit-on-leak options. Disable detection during test profiling and document local usage.
  • Restore integration and system CI reporting and dump artifacts. Unit, integration, and system jobs collect host JVM dumps and container archives; update archive discovery to Gradle's build/container-logs path.
  • Copy container logs after graceful service shutdown and before removal. Add Docker regression tests for standalone and supervisor-managed JVMs to the standalone suite.

Verifying this change

  • Make sure that the change passes the CI checks.

Local validation passed:

  • ./gradlew spotlessCheck checkstyleMain checkstyleTest, quickCheck, and assemble.
  • NettyLeakDetectionTest against a locally built Docker test image. Both shutdown modes fail on missing reports before the collection fix and pass afterward with real ByteBuf leaks.
  • A scoped buildtools test and isolated leak probes covering default/report/fail_on_leak/off modes, custom levels, local exit-on-leak, profiling, and configuration-cache reuse.
  • Host and container archive collection in report and fail-on-leak modes, and workflow wiring checks for all three test jobs.

Does this pull request potentially affect one of the following parts:

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations — restores paranoid leak detection for test JVMs; production defaults are unchanged.
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Enable ExtendedNettyLeakDetector with the branch-4.2 paranoid defaults and restore the testLeakDetectionLevel and testExitJvmOnLeak options. Honor NETTY_LEAK_DETECTION=off and keep test profiling free of leak-detection overhead. Document local and CI usage.

Validated with quickCheck, assemble, a scoped buildtools test, configuration-cache reuse, and an isolated intentional ByteBuf leak probe covering default/report/fail_on_leak/off modes, level overrides, profiling, and JVM exit on leak.

Assisted-by: Codex
Pass the selected leak-detection mode and dump directory to integration and system jobs, collect their leak reports, and preserve dumps as artifacts. Read container leak archives from the Gradle build directory instead of the obsolete Maven target directory.

Validated workflow wiring and shell syntax, plus report and fail_on_leak exit statuses using both actual JVM leak dumps and container log archives.

Assisted-by: Codex
Collect Pulsar container logs after graceful service shutdown and before container removal so ExtendedNettyLeakDetector shutdown-hook reports are retained. Preserve cleanup if stopping or collecting logs fails.

Add live Docker regressions for standalone and supervisor-managed JVMs, and run them in the standalone suite. Both reproduce missing shutdown reports before the fix and pass afterward. Add eight CI collector cases for host-only, container-only, combined, and clean runs in report and fail_on_leak modes.

Validation: Docker test image build, scoped integration tests with configuration-cache reuse, Python collector regression tests, unit/integration/system workflow wiring checks, and quickCheck.

Assisted-by: Codex
Remove the Python regression script and its CI step to keep leak-detection support focused on the existing Gradle and Docker test infrastructure.

Assisted-by: Codex
@lhotari

lhotari commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

Blocked by this lightproto issue: streamnative/lightproto#21

@lhotari
lhotari marked this pull request as ready for review September 17, 2026 11:21
@lhotari
lhotari marked this pull request as draft September 17, 2026 11:22
@lhotari
lhotari marked this pull request as ready for review September 17, 2026 14:29
@lhotari
lhotari merged commit b09d290 into apache:master Sep 17, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants