Skip to content

Commit b28044c

Browse files
Tim-Brooksjasontedor
authored andcommitted
Release pipelined request in netty server tests (#32368)
The Netty4HttpServerPipeliningTests adds a different request handler to the netty pipeline. This request does not properly release pipelined request. This means that when we enable leak detection, the test fails. This commit properly releases the request.
1 parent 138466e commit b28044c

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerPipeliningTests.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import io.netty.handler.codec.http.HttpResponseStatus;
3434
import io.netty.handler.codec.http.HttpVersion;
3535
import io.netty.util.ReferenceCounted;
36-
import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
3736
import org.elasticsearch.common.network.NetworkService;
3837
import org.elasticsearch.common.settings.Setting;
3938
import org.elasticsearch.common.settings.Settings;
@@ -122,7 +121,6 @@ public void testThatHttpPipeliningWorksWhenEnabled() throws Exception {
122121
assertSettingDeprecationsAndWarnings(new Setting<?>[] {HttpTransportSettings.SETTING_PIPELINING});
123122
}
124123

125-
@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/32900")
126124
public void testThatHttpPipeliningCanBeDisabled() throws Exception {
127125
final Settings settings = Settings.builder()
128126
.put("http.pipelining", false)
@@ -261,8 +259,7 @@ public void run() {
261259

262260
final ByteBuf buffer = Unpooled.copiedBuffer(uri, StandardCharsets.UTF_8);
263261

264-
final DefaultFullHttpResponse httpResponse =
265-
new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, buffer);
262+
final FullHttpResponse httpResponse = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, buffer);
266263
httpResponse.headers().add(HttpHeaderNames.CONTENT_LENGTH, buffer.readableBytes());
267264

268265
final boolean slow = uri.matches("/slow/\\d+");
@@ -284,10 +281,7 @@ public void run() {
284281
msg = httpResponse;
285282
}
286283
ctx.writeAndFlush(msg, promise);
287-
} finally {
288-
if (fullHttpRequest != null) {
289-
fullHttpRequest.release();
290-
}
284+
} finally {
291285
if (pipelinedRequest != null) {
292286
pipelinedRequest.release();
293287
}

0 commit comments

Comments
 (0)