Skip to content

WiretapConnector leaks data buffers when response body not consumedΒ #36050

Closed

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.

Activity

  1. added this to the 7.0.3 milestone on Dec 19, 2025
  2. self-assigned this
    on Dec 19, 2025
  3. added
    in: webIssues in web modules (web, webmvc, webflux, websocket)
    on Dec 19, 2025
  4. added a commit that references this issue on Dec 19, 2025
    be68a77
  5. added a commit that references this issue on Dec 19, 2025
    7353ab4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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