Forums » Development »
Time-outs on SMTP server block changes in Redmine?
Added by Olivier Houdas about 9 years ago
Hi All,
Sometimes it occurs that the SMTP server is not reachable. It can be because of the company's outgoing Internet link, or because of the availability of the STMP server, for example.
In those cases, we experience Error 500 for saving the changes to the edited issue.
In that situation, changes seem to have been lost. A refresh with resubmit of the data can work, but if users are not aware of that, they close the page, and lose their changes.
1) Would anybody have a work-around to avoid getting an Error 500 in this situation, and maybe have a warning that sending the mails failed, but at least save the changes?
2) Where can we set the mail sending time-out?
Thanks also for sharing any experience on the subject, like what do you tell your users, or how you configured your servers & network to avoid such issues.
Olivier
Replies (3)
RE: Time-outs on SMTP server block changes in Redmine? - Added by Jan from Planio www.plan.io about 9 years ago
Please have a look at EmailConfiguration. It explains how to set up asynchronous email delivery in Redmine.
RE: Time-outs on SMTP server block changes in Redmine? - Added by Olivier Houdas about 9 years ago
Thank you for that link.
However,
- I set it up on Friday, and we got our worst ever crash of Redmine: the website stopped responding completely after one hour with the new configuration, and I had to reboot Linux, rebooting the web service being not enough.
Note that it might be my mistake, I had switched to "tls:true" instead of "enable_starttls_auto: true", which seems not to be supported by our SMTP server. However, the server did get blocked (without error messages in the log) and that was not very nice - with the asynchronous setting, we have no means to know that emails failed to be sent, but for looking at the log, which is an issue in our case (we use the RedmineCRM plugin and handle our support with Redmine, and we need to know if our replies failed to reach the clients)
RE: Time-outs on SMTP server block changes in Redmine? - Added by Olivier Houdas almost 9 years ago
- Errors 500 happened because of a plugin: I fixed that (and informed the plugin author) and changes to issues could get saved even when mails could not be sent;
- getting warned about unsent messages: if action_mailer.raise_delivery_errors is set to false (in production.log), mail errors only go to the log. If it is set to true, mail sending exceptions are not rescued and create Error 500 pages. I have made changes to the Redmine code so as not to re-raise the exceptions in such cases, and flash error messages in the resulting pages (issues, document, wiki, etc.), and this solution fits us
- slow Redmine: in case of network issue and the SMTP is not available, we get a Net::openTimeout error (in sync mode), which comes after 30s. This is the default time-out, which cannot be changed at the moment. There is a pull request on the Mail Ruby gem to make this time-out configurable. I applied that github pull request and set open_timeout and read_timeout to 5 (seconds) in my configuration.yml, and now we get the Redmine pages in 5s, with changes saved, and with "Execution expired" errors flashed in the page, so that our users can warn people separately if needed.
Our users are now satisfied again with our Redmine site ! (and hopefully our Internet link issues will get solved soon as well, as it is obviously not a normal situation)