-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HttpClient] memory leak #46256
Comments
I was able to trace the memory leak to the following line: To me it looks like it's a problem with fopen in conjunction with a stream wrapper. The memory usage does not increase continuously, but jumps sometimes to a high value and then falls back again. The distances between the jumps are getting bigger each time: |
It doesn't look like an error in the HttpClient to me, but in the PHP source code. So I opened a ticket there. |
This should be fixed by #47143 |
…olas-grekas) This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] Fix memory leak when using StreamWrapper | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #46256 | License | MIT | Doc PR | - As hinted in php/php-src#8548 Commits ------- 16d0176 [HttpClient] Fix memory leak when using StreamWrapper
Symfony version(s) affected
6.0.8
Description
Hi,
I'm hunting a memory leak since few days and finally found where it might be.
Context: I've a loop that do some work. Some metrics are collected, and pushed via a http request to a prometheus pushgateway.
When the Psr18Client is handling the response body, the leak happens.
How to reproduce
Here you can find a MRE: https://github.com/Gounlaf/sf-http-client-memory-leak
It rely on docker & docker-compose;
up
the service debug and then check your processes. You will find that memory of php process is increasing with$psr18Client = new Psr18Client(new \Symfony\Component\HttpClient\NativeHttpClient());
or
$psr18Client = new Psr18Client(new \Symfony\Component\HttpClient\CurlHttpClient());
It doesn't with another (not symfony) implementation
$psr18Client = new \Http\Client\Curl\Client($psr17factory, $psr17factory);
If this MRE is not enough, please let me know.
Regards.
Possible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: