Skip to content

WiretapConnector leaks data buffers when response body not consumed #36050

@bclozel

Description

@bclozel

in #35953, one of the cases described shows that using the WebTestClient the following way leaks data buffers:

var body = client.get().uri("download")
  .exchange()
  .expectStatus().isOk()
  .returnResult()
  .getResponseBodyContent();

Here, the test performs expectations on the response status and headers, but not on the response body. The WiretapConnector already supports this case by subscribing to the Flux response body in those cases and accumulates the entire content as a single byte[]. In this case, the DataBuffer instances are not decoded by any Decoder and are not released. This results in a memory leak.

We should ensure that the automatic subscription in WiretapConnector also releases the buffers automatically as the DSL does not allow at that point to go back to performing body expectations.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions