Description
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes |
Symfony version | >= 3.4 |
I would like to get your opinion concerning the WebDebugToolbar
and potentially long running kernel.terminate
events when sending spooled mails which "breaks" the toolbar
The 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 through Symfony\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 the WebDebugToolbar
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:
- increase the number of retries for the ajax call (possibly through a configurable value)
or
- add a small delay before sending the
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
if (!$profile = $this->profiler->loadProfile($token)) {
sleep(1);
return new Response('', 404, array('Content-Type' => 'text/html'));
}
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