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

Fix memory leaks #181

Merged
merged 3 commits into from Apr 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Worker.php
Expand Up @@ -3,6 +3,7 @@
namespace Laravel\Octane;

use Closure;
use Illuminate\Container\Container;
use Illuminate\Foundation\Application;
use Illuminate\Http\Request;
use Laravel\Octane\Contracts\Client;
Expand Down Expand Up @@ -110,6 +111,11 @@ public function handle(Request $request, RequestContext $context): void
} catch (Throwable $e) {
$this->handleWorkerError($e, $sandbox, $request, $context, $responded);
} finally {
$sandbox->flush();
Copy link
Contributor

@albertcht albertcht Apr 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it's okay to remove other sandbox' forgetInstance call in FlushTemporaryContainerInstances?
(Not sure if it's necessary to call forgetInstance in FlushAuthenticationState)


$this->app->make('view.engine.resolver')->forget('blade');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to forget all? If not, could it be added to Laravel today. Otherwise, other custom things will still cause leaks.

$this->app->make('view.engine.resolver')->forget('php');

// After the request handling process has completed we will unset some variables
// plus reset the current application state back to its original state before
// it was cloned. Then we will be ready for the next worker iteration loop.
Expand Down