-
Notifications
You must be signed in to change notification settings - Fork 297
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
Fix memory leaks #181
Conversation
@themsaid looks like our tests need fixing. |
@taylorotwell the PR depends on laravel/framework#36955 so it'll be fixed when we can lock to the release tomorrow. |
@@ -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(); | |||
|
|||
$this->app->make('view.engine.resolver')->forget('blade'); |
There was a problem hiding this comment.
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.
@@ -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(); |
There was a problem hiding this comment.
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 PR fixes memory leaks in Octane as reported in #171
This will flush the entire sandbox container. This will clear any references to request-content singletons which allows PHP's garbage collector from clearing the memory when
unset($sandbox)
is called.These lines deal with a memory leak in facade/ignition as explained in laravel/framework#36955.