Skip to content

Memory leak in ClientToProxyConnection.doReadHTTPInitial(); #442

@maxTraydakalo

Description

@maxTraydakalo

Hi Adam and all contributors. You and your proxy is awesome, thanks for that great job.

I found in ClientToProxyConnection.doReadHTTPInitial(HttpRequest httpRequest) this line of code this.currentRequest = copy(httpRequest);
In case of FullHttpRequest it makes copy. That copy of FullHttpRequest using for instantiate HttpFilters. I look closer to this variable and what i found out in dependency tree: FullHttpRequest -> FullHttpMessage -> LastHttpContent and the last one holds io.netty.buffer.ByteBuf content().
According to this article https://netty.io/wiki/reference-counted-objects.html the last one who used this buffer should release him to deallocate memory, but i don't find any place where this resource are releasing.

A little about how i get problem with out of memory exception. I'm using little proxy for uploading large files to amazon s3 server. The last tries i uploading files about 5-8GB and got out of memory exception with consuming about 6GB RAM. Why do i decide that the problem is in this copy method? This request copy used to instantiate class that i extend from HttpFiltersAdapter so i just release this request resources in constructor in case if it is FullHttpRequest and supress exceptions with try catch. After that i'm able to upload large files to aws s3 server and don't see any presence of memory leak.

Can someone who is more familiar with little proxy confirm or deny my suggestion?

P.S: sorry for cumbersome issue description and english, actually my first try.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions