-
Notifications
You must be signed in to change notification settings - Fork 266
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
Add better handling of crashes on socket closure by client #270
base: master
Are you sure you want to change the base?
Conversation
…o a client Add vim formatting Fix compilation issue
I wonder if it is really necessary to use funs in the scenarios where you use It just becomes a bit difficult to reason about the order in which code lines are executed looking at the functions using |
The main issue is that when errors are thrown, the error log has a ton of details pertaining to the crashed gen_server, whereas in the majority of cases, especially when the server closes the socket after ELHO or similar scenarios, we don't really need to put the crash details in the log. Generally, I think the current implementation needs a major revision to clean up and simplify that logic, but this is merely a patch to make the existing code more usable. |
@saleyn the thing is that so
is equivalent of
(same works for Also, if you When I implemented User can define
to suppress error_logger reports when |
If my memory serves me, a while back when I was implementing an SMTP server based on gen_smtp, the issue was that there were many places were gen_tcp/ssl's send/2 function would return an error, and this would result either in a failed match I recall seeing this behavior on ELHO and QUIT messages, e.g. when the server was trying to send QUIT, by which time a client already closed the socket. Hence, I had to implement some more refined handing of those edge cases to eliminate useless log reports of process crashes. |
depends on how long ago, because I made 2 PRs where error handling have been noticeably improved relatively recently: #211 adds |
I believe it was more or less at the end of 2020 using the HEAD of master branch. |
Oh, that's strange. Looking at the code, it seems the only place where we are not using I would rally appreciate if you could provide some small example where we could reproduce it! |
I've had this patched code running in production for the good part of this year, and haven't seen these issues. So it would be hard to reproduce without rolling back to the unpatched version, which is not something I could do any time soon. So you can table this PR for now, I guess. If I have more updates on this, I'll let you know. |
@saleyn I also have gen_smtp master server running in production with the following customized
and I indeed suppress |
It certainly would be helpful to include this in the example server, and mention your comments from this thread there. |
Add functionality to terminate gen_server gracefully in case of SSL handshake errors or premature closing of socket by an SMTP client.