GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Potential buffer leak in HttpObjectEncoder · Issue #6729 · netty/netty

Potential buffer leak in HttpObjectEncoder #6729

New issue
Copy link
New issue
Copy link
Closed
Closed
Potential buffer leak in HttpObjectEncoder#6729
Copy link
Labels
needs info

Description

@trustin
trustin
opened on May 10, 2017
Issue body actions

4.1.10.Final. According to the commit history, HttpObjectEncoder did not change since December last year (4.1.7), so I'm not really sure it's a problem, but saw this:

LEAK: ByteBuf.release() was not called before it's garbage-collected. See http://netty.io/wiki/reference-counted-objects.html for more information.
WARNING: 3 leak records were discarded because the leak record count is limited to 4. Use system property io.netty.leakDetection.maxRecords to increase the limit.
Recent access records: 5
#5:
    io.netty.buffer.AdvancedLeakAwareByteBuf.setBytes(AdvancedLeakAwareByteBuf.java:354)
    io.netty.buffer.ByteBufUtil.copy(ByteBufUtil.java:735)
    io.netty.handler.codec.http.HttpHeadersEncoder.writeAscii(HttpHeadersEncoder.java:48)
    io.netty.handler.codec.http.HttpHeadersEncoder.encoderHeader(HttpHeadersEncoder.java:35)
    io.netty.handler.codec.http.HttpObjectEncoder.encodeHeaders(HttpObjectEncoder.java:160)
    io.netty.handler.codec.http.HttpObjectEncoder.encode(HttpObjectEncoder.java:79)
    ...

According to the access records, something happened before writing all headers into the buffer allocated by HttpObjectEncoder, and is lost probably due to an exception. I couldn't find what the exception which may have caused this, however. (The log file is very crowded.)

Activity

  1. Scottmitch commented on May 18, 2017

    @Scottmitch
    Scottmitch
    on May 18, 2017
    Member
    More actions

    @trustin - if you can reproduce please increase io.netty.leakDetection.maxRecords as suggested and report back with the leak trace ... we may not have the complete picture here.

  2. trustin commented on May 18, 2017

    @trustin
    trustin
    on May 18, 2017
    MemberAuthor
    More actions

    It was in the header encoding loop, so increasing maxRecords might not help much here.

    It seems like the leak is gone after fixing some other leak which triggered OOME. So, my guess is that somehow an exception (OOME?) was triggered while encoding the headers and that triggered the leak reported in this issue.

    Let me close this issue and file a new one when I see this again. Thanks for taking your time, @Scottmitch !

    Reacted by Scott Mitchell
  3. trustin
    closed this as completedon May 18, 2017
  4. trustin
    added
    needs info
    on May 18, 2017
  5. chrisvest
    added a commit that references this issue on Jul 31, 2026

    `HttpObjectEncoder` / `DefaultHttp2FrameWriter`: fix buffer leak when…

    10e24f9
  6. normanmaurer
    added a commit that references this issue on Aug 3, 2026

    Auto-port 4.1: `HttpObjectEncoder` / `DefaultHttp2FrameWriter`: fix b…

    25f7e5e
  7. lltopk
    added a commit that references this issue on Oct 24, 2026

    Auto-port 4.1: `HttpObjectEncoder` / `DefaultHttp2FrameWriter`: fix b…

    2becb07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs info

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.