-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[RFC][WebProfilerBundle] Slow kernel.terminate can prevent Toolbar from loading #25849
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
Comments
I'm not sure there is anything we should do on Symfony's side. Making background tasks on kernel.terminate should be replaced by a proper job queue when this situation is reached instead. |
In general i agree with you however in this case we are not really talking about making some big tasks on kernel.terminate. Moving the email sending to a job or setup an infrastructure using exim or anything like that would of course work around the problem but seems like a bit too much for a simple workaround. |
Well, there is 3 options for that IMO:
As we already retry the loading of the toolbar, the third solution might be a viable option, by only delaying retries (so that the loading is not delayed too much for most pages not using |
note that delaying the retry should not be done by blocking the server during 1s before sending the 404 for the previous try. It should rather be done by making the JS wait (in a non-blocking way) before the retry. |
guess that could be easily done by small changes to the js without any side effects:
and
|
@JoeKre would you mind sending a PR? |
First time for everything i guess :) I hope i didn't completely screw something up with the process for contributing. |
…rAction ajax calls (JoeKre) This PR was submitted for the master branch but it was squashed and merged into the 2.7 branch instead (closes #25967). Discussion ---------- [WebProfilerBundle] Increase retry delays between toolbarAction ajax calls | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes/no | Fixed tickets | #25849 | License | MIT | Doc PR | - Commits ------- 3288fb0 [WebProfilerBundle] Increase retry delays between toolbarAction ajax calls
Fixed by #25967. |
I would like to get your opinion concerning the
WebDebugToolbar
and potentially long runningkernel.terminate
events when sending spooled mails which "breaks" the toolbarThe scenario can be described as follows:
When using the
SwiftMailerBundle
with any type of spooling active i.e.spool: { type: memory }
the actual sending will be done throughSymfony\Bundle\SwiftmailerBundle\EventListener\EmailSenderListener
before the kernel is actually terminated.This will lead to the
EmailSenderListener
blocking the kernel termination until the response from your email provider is fully processed.Until the kernel is fully terminated the profile for the given token cannot be loaded.
While this is happening the toolbar might already try to load the profile data through its ajax call.
Based on the performance of the email provider or any potential
SwiftMailer plugins
it can happen that theWebDebugToolbar
will quit after the 5 tries to load the profile and show the error instead.Two possible fixes for this problem could be to either:
or
404
if the profile could not be loaded and create more time forkernel.terminate
to finish running.Simplified example in
Symfony\Bundle\WebProfilerBundle\Controller\ProfilerController::toolbarAction
Is there any need to fix this "problem" which is mildly annoying although it's not actually a bug in the profiler?
If someone should fix it, or rather give the toolbar more leeway to load the profile data, which way would be a preferred one?
kind regards
Joe
The text was updated successfully, but these errors were encountered: