-
Notifications
You must be signed in to change notification settings - Fork 168
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
Infinite loop with mailer monolog service when running Symfony 5.4 #796
Comments
I disabled the |
Could you please share the Monolog configuration you're using to reproduce the issue? |
packages/monolog.yaml: monolog:
channels:
- app
- import
- translation
handlers:
backoffice:
type: symfony_mailer
from_email: '[email protected]'
to_email:
- '[email protected]'
subject: '[XXXXX] %%message%%'
level: warning
formatter: monolog.formatter.html
content_type: text/html
channels:
- ratedownload
developers:
type: symfony_mailer
from_email: '[email protected]'
to_email:
- '[email protected]'
subject: '[XXXXXX] %%message%%'
level: warning
formatter: monolog.formatter.html
content_type: text/html
channels:
- app monolog/prod/monolog.yaml:
|
I tried using your configuration and I cannot reproduce the issue. I didn't set the |
I tried to reproduce it in an empty project. In this project, the protected function getMailer_TransportFactory_NullService()
{
$a = ($this->privates['monolog.logger.mailer'] ?? $this->getMonolog_Logger_MailerService());
if (isset($this->privates['mailer.transport_factory.null'])) {
return $this->privates['mailer.transport_factory.null'];
}
$b = ($this->services['event_dispatcher'] ?? $this->getEventDispatcherService());
if (isset($this->privates['mailer.transport_factory.null'])) {
return $this->privates['mailer.transport_factory.null'];
}
$c = ($this->privates['.debug.http_client'] ?? $this->get_Debug_HttpClientService());
if (isset($this->privates['mailer.transport_factory.null'])) {
return $this->privates['mailer.transport_factory.null'];
}
return $this->privates['mailer.transport_factory.null'] = new \Symfony\Component\Mailer\Transport\NullTransportFactory($b, $c, $a);
} In the 'broken' project, it looks like this: /**
* Gets the private 'mailer.transport_factory.null' shared service.
*
* @return \Symfony\Component\Mailer\Transport\NullTransportFactory
*/
protected function getMailer_TransportFactory_NullService()
{
include_once \dirname(__DIR__, 4).''.\DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR.'symfony'.\DIRECTORY_SEPARATOR.'mailer'.\DIRECTORY_SEPARATOR.'Transport'.\DIRECTORY_SEPARATOR.'TransportFactoryInterface.php';
include_once \dirname(__DIR__, 4).''.\DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR.'symfony'.\DIRECTORY_SEPARATOR.'mailer'.\DIRECTORY_SEPARATOR.'Transport'.\DIRECTORY_SEPARATOR.'AbstractTransportFactory.php';
include_once \dirname(__DIR__, 4).''.\DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR.'symfony'.\DIRECTORY_SEPARATOR.'mailer'.\DIRECTORY_SEPARATOR.'Transport'.\DIRECTORY_SEPARATOR.'NullTransportFactory.php';
$a = ($this->services['event_dispatcher'] ?? $this->getEventDispatcherService());
if (isset($this->privates['mailer.transport_factory.null'])) {
return $this->privates['mailer.transport_factory.null'];
}
return $this->privates['mailer.transport_factory.null'] = new \Symfony\Component\Mailer\Transport\NullTransportFactory($a, ($this->privates['.debug.http_client'] ?? $this->get_Debug_HttpClientService()), ($this->privates['monolog.logger.mailer'] ?? $this->getMonolog_Logger_MailerService()));
} The The repository with the example that works is at https://github.com/jorrit/sentry-symfony-bug-demo. |
I tried cloning your repository and running the |
I know, the repository works fine. I have yet to figure out why that repository works and my private project doesn't. It has something to do with the difference in how the DI container is generated. I'll close this issue because at this moment it doesn't seem to involve sentry directly. I will reopen when there might be something that can be improved here. Thank you for your time. |
How do you use Sentry?
Sentry SaaS (sentry.io)
SDK version
3.6.0
Steps to reproduce
sentry/sentry-symfony
in a Symfony 5.4 application.symfony_mailer
handler.Expected result
Working Symfony application
Actual result
Infinite loop:
This is the recurring part of the stack trace:
Basically, the Monolog initializes the Monolog handlers, which get a tracable HTTP service injected, which requires the Monolog service again.
I guess this is something specific in my installation (I recently updated from Symfony 4.4), otherwise others would have reported this already.
The text was updated successfully, but these errors were encountered: