Skip to content
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

Memory leak when using Http facade #481

Closed
Ostojic-96 opened this issue Feb 21, 2022 · 3 comments
Closed

Memory leak when using Http facade #481

Ostojic-96 opened this issue Feb 21, 2022 · 3 comments
Assignees

Comments

@Ostojic-96
Copy link

  • Octane Version: v1.2.1
  • Laravel Version: v9.0.2
  • PHP Version: 8.1
  • Server & Version: Openswoole 4.9.1
  • Sail version: v1.13.2

When I'm using Http facade memory is going up with every request. My setup is made with Laravel Sail.

Route::get('test', function () {
Http::get('https://swapi.dev/api/people/1');

return memory_get_usage();
});

http facade leak

This is not the case with the Guzzle client

Route::get('test', function () {
    $client = new \GuzzleHttp\Client();
    $client->get('https://swapi.dev/api/people/1');
    return memory_get_usage();
});  

guzzle

I already tried other channels like Discord, Laracasts, Stackoverflow but didn't get any answers.

@driesvints
Copy link
Member

@Ostojic-96 can you link to the Laracasts and Stackoverflow threads?

@Ostojic-96
Copy link
Author

@Ostojic-96 can you link to the Laracasts and Stackoverflow threads?

Sure.
Laracasts
Stackoverflow

@nunomaduro
Copy link
Member

I've tested this exact code with wrk and millions of requests, and there is no memory leak here. The fact that you see the memory increasing for a few requests just means that Octane didn't run the gc_collect_cycles yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants