-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Mailer] Throw TransportException
when unable to read from socket
#53157
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
[Mailer] Throw TransportException
when unable to read from socket
#53157
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
Hey! Thanks for your PR. You are targeting branch "7.1" but it seems your PR description refers to branch "5.4". Cheers! Carsonbot |
b49f580
to
2e9669f
Compare
2e9669f
to
83e4e06
Compare
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.
This is a great PR. Thank you.
I think we should throw an exception here.
According to the manual for fgets
:
If there is no more data to read in the file pointer, then false is returned. If an error occurs, false is returned.
We check for eof()
earlier in this method. So if fgets
returns false here it must be an error and we should convert it to an exception.
TransportException
when unable to read from socket
83e4e06
to
44d5b57
Compare
Thank you @xdanik. |
We are seeing error
fgets(): SSL: Connection reset by peer
multiple times a day from connection to Office 365 SMTP server (smtp.office365.com:587).It's certainly related to some kind of timeout as we are sending emails from long running queue dispatcher and error shows up only occasionally and never with the first message. We are not seeing this issue with any other SMTP server, but we have not tested much past smtp.mandrillapp.com and local MailHog.
We have tried adjusting the
$pingThreshold
and$restartThreshold
options, but without much success (well$restartThreshold = 1
resolves the issue, but it also forces the transport to close connection after each message).Stack trace:
App is running on PHP 8.0.28 on Debian Linux x64, Mailer v5.4.22.
I would gladly written some tests for this, but I don't know how to simulate calls to low-level stream functions like fgets.