Closed xdanik closed 3 years ago
What version of this library are you using please? I think we may have already fixed this?
I am using guzzle 6.5.5 + promises 1.4.1, but I have just tested that it also happens on guzzle 7.3.0 + promises 1.5.0.
Thanks. Are you able to submit a PR to fix this please.
Unrelated, but note that Guzzle 6 is EOL.
@GrahamCampbell Here you go 😉.
PHP version: 7.4.12 Description
Creating
\GuzzleHttp\Pool
with$requests
being empty array/iterator, and calling$pool->promise()
causes memory leak as the promise is never freed from memory. Its caused byGuzzleHttp\Promise\EachPromise->createPromise()
that registers$clearFn
in order to remove references after the promise is resolved. But$clearFn
is never called in case of empty iterator / no promises to be handled.How to reproduce
Possible Solution Call
$clearFn
immediately if$this->pending
is empty insideGuzzleHttp\Promise\Eachpromise->createPromise()
🤔.