Defect #18647
closedActiveRecord::StatementInvalid with async_smtp
0%
Description
I switched my mail settings from
default: delivery_method: :smtp smtp_settings: address: "smtp.my-server.com" port: 25
to
default: delivery_method: :async_smtp async_smtp_settings: address: "smtp.my-server.com" port: 25
for performance reasons.
With async_smtp I get the following error (in production.log), if I try to save I new ticket or if I edit an existing ticket:
ActiveRecord::StatementInvalid (Errno::ECONNREFUSED: Connection refused - connect(2): UPDATE `custom_values` SET `value` = '0' WHERE `custom_values`.`id` = 5011): config/initializers/10-patches.rb:137:in `block in deliver!'
There are no problems with smtp (without async).
Redmine version 2.5.3.stable
Ruby version 2.0.0-p576 (2014-09-19) [x86_64-linux]
Rails version 3.2.19
Environment production
Database adapter Mysql2
Updated by Alexander Meindl about 10 years ago
Our STMP server is very slow (because of spam and virus protection). If I use non-async it takes 10 seconds to save a ticket, because of the mails. Maybe this helps.
And of course the error message only appears, if redmine has to deliver notifications.
Updated by Jean-Philippe Lang about 10 years ago
Can you make sure that your mysql server accepts multiple simultaneous connections for the same user?
Updated by Alexander Meindl about 10 years ago
Hmm, I use MySQL server 5.6.21 (from dotdeb.org) at debian wheezy. max_connections = 100 in my.cnf. I also have no restriction for the database user. I made a test on two consoles: in each console I run a sql command with the same database user - this worked without problems.
Can I give you more information to narrow the problem?
Updated by Alexander Meindl about 10 years ago
- Status changed from New to Resolved
I found a solution. I had to add the following line to my database.yml configuration file:
pool: 5
I tried this, because I read http://stackoverflow.com/questions/15086880/correct-setting-of-database-connection-pool-database-yml-for-single-threaded-rai something about pool size and multi tread rails applications.
Updated by Toshi MARUYAMA almost 10 years ago
- Category changed from Issues to Database
- Status changed from Resolved to Closed
Thank you for your feedback.