amphp / hpack

HPack - HTTP/2 header compression implementation in PHP.

Home Page:https://amphp.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory leak when using HPackNghttp2

xpader opened this issue · comments

In my server, Ubuntu 20.04 (amd64), php 8.0.29, when using http-client with HPackNgHttp2, php process memory will getting keep increase.
But change to HPackNative, php process memory will be stable within a certain range.

But the noted is memory info from memory_get_usage() is normal, looks like memory is leaking out of php memory manager, this makes memory_get_usage() can not get real memory usage.

Is this a FFI bug? or amphp/hpack bug?

Some related links:
php/php-src#8433

How can this reproduced? I tried running requests in a loop, but this doesn't seem to reproduce it. How large is the leak?

@kelunik It's keeping increase, until system memory is exhausted. When I use HPackNgHttp2, I have to restart my application after 3~4 days in my 16G memory server.

My code have some different, every user have a single HttpClient instance, not shared HttpClient instance.

Maybe you can try create new HttpClient and do some request in loop, this may reproduced.