Skip to content

Conversation

@daschl
Copy link
Contributor

@daschl daschl commented Jan 20, 2025

This changeset improves discovery of netty-related buffer leaks if the --warn flag is enabled on the command line when running the gradle tests. Paranoid is enabled all the time now, but the overhead of doing so is very minimal and does not need to be enabled conditionally. --warn is needed since only in that mode stdout is visible on the command line.

Running it showed a couple of leaks in tests where two of them are already fixed as part of this commit.

@daschl daschl requested a review from idelpivnitskiy January 20, 2025 12:09
This changeset improves disovery of netty-related buffer leaks if
the --warn flag is enabled on the command line when running the
gradle tests. Paranoid is enabled all the time now, but the overhead
of doing so is very minimal and does not need to be enabled conditionally.
--warn is needed since only in that mode stdout is visible on the
command line.

Running it showed a couple of leaks in tests where two of them are
already fixed as part of this commit.
systemProperty "io.servicetalk.transport.netty.requireNativeLibs", "true"

// Make sure we enable netty leak detection for our tests. By default these are not visible in the logs,
// to see them you must at --warn to your ./gradlew test run in order to see the "showStandardStreams".
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at -> add?

ByteBuf payloadBody = channel.readOutbound();
assertThat("Unexpected response payload body", payloadBody.toString(US_ASCII), equalTo(RESPONSE_PAYLOAD_BODY));
metaData.release();
payloadBody.release();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these should be in a finally block bcz if assertions throw, your new lines won't be invoked


// Make sure we enable netty leak detection for our tests. By default these are not visible in the logs,
// to see them you must at --warn to your ./gradlew test run in order to see the "showStandardStreams".
systemProperty "io.netty.leakDetection.level", "PARANOID"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the main goals is to check for leaks automatically via ci-prb.yml pipeline. There we can not simply add --warn because it will result in extremely long unreadable build output. We reduced events down to [FAILED] because of that.

We should find a way to always be PARANOID on CI with output to standard streams without changing events, while local development should be more like opt-in for leak detection output as a way to troubleshoot when CI finds something.

One potential idea is to change showStandardStreams logic to be a check on io.netty.leakDetection.level. If it's PARANOID, then it results to true. And then add a system property in ci-prb.yml. Maybe there is other ways as well.

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.

2 participants