部署 Gitlab 不停的发邮件

c605 · 2013年04月01日 · 最后由 Saito 回复于 2013年04月02日 · 5877 次阅读

打算使用 Gitlab 在公司内部管理代码,但是部署完成后发现 sidekiq 不停的发送邮件,主要原因是发送完邮件后出错

有谁遇到过这个问题吗?

下面是错误日志:

2013-03-28T17:21:14Z 24394 TID-gomcg Sidekiq::Extensions::DelayedMailer JID-53fc768885aed0fcfabde8b8 INFO: start
2013-03-28T17:21:44Z 24394 TID-gomcg Sidekiq::Extensions::DelayedMailer JID-53fc768885aed0fcfabde8b8 INFO: fail: 30.012 sec
2013-03-28T17:21:44Z 24394 TID-gomcg WARN: {"retry"=>true, "queue"=>"default", "timeout"=>30, "class"=>"Sidekiq::Extensions::DelayedMailer", "args"=>["---\n- !ruby/class 'Notify'\n- :reassigned_issue_email\n- - 3\n  - 1\n  - 3\n"], "at"=>1364489684.0476549, "jid"=>"53fc768885aed0fcfabde8b8", "error_message"=>"execution expired", "error_class"=>"Timeout::Error", "failed_at"=>"2013-03-28T16:55:28Z", "retry_count"=>6, "retried_at"=>2013-03-28 17:21:44 UTC}
2013-03-28T17:21:44Z 24394 TID-gomcg WARN: execution expired
2013-03-28T17:21:44Z 24394 TID-gomcg WARN: /home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/mail-2.5.3/lib/mail/network/delivery_methods/sendmail.rb:61:in `close'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/mail-2.5.3/lib/mail/network/delivery_methods/sendmail.rb:61:in `popen'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/mail-2.5.3/lib/mail/network/delivery_methods/sendmail.rb:61:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/mail-2.5.3/lib/mail/network/delivery_methods/sendmail.rb:57:in `deliver!'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/mail-2.5.3/lib/mail/message.rb:2033:in `do_delivery'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/mail-2.5.3/lib/mail/message.rb:229:in `block in deliver'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.13/lib/action_mailer/base.rb:415:in `block in deliver_mail'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.13/lib/action_mailer/base.rb:413:in `deliver_mail'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/mail-2.5.3/lib/mail/message.rb:229:in `deliver'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/extensions/action_mailer.rb:23:in `perform'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/processor.rb:45:in `block (3 levels) in process'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:109:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:109:in `block in invoke'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/server/timeout.rb:11:in `block in call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/server/timeout.rb:10:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/server/retry_jobs.rb:49:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/server/logging.rb:11:in `block in call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/logging.rb:22:in `with_context'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/server/logging.rb:7:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:114:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/middleware/chain.rb:114:in `invoke'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/processor.rb:44:in `block (2 levels) in process'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/processor.rb:80:in `stats'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.7.5/lib/sidekiq/processor.rb:43:in `block in process'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/calls.rb:23:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/calls.rb:23:in `public_send'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/calls.rb:23:in `dispatch'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/future.rb:18:in `block in initialize'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/internal_pool.rb:48:in `call'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/internal_pool.rb:48:in `block in create'

好基友:http://ruby-china.org/topics/9898 😄 歪楼了,抱歉,我没搞过 gitlab,帮不了你,期待楼下的答案

#1 楼 @HungYuHei 汗……无奈啊,在 Gitlab 的 issue 也提了几天了,没人理我 Orz ……

是的,昨天还有一个人说打 sidekiq 的 log 打了 31.8G..

如果懂 ruby 的话可以先稍为 hack 一下,不让 sidekiq 打 log...

#3 楼 @Saito log 也确实有点多,可问题是不光 log 多,而且邮件也多啊!!!!一个改变权限的邮件发了一晚上,发了 100 多封!!!

好搞,我也看到了 #1 楼 @HungYuHei

@c605 @Zernel 其实挺好解决的,加一个 retry 就好了。

因为你每次发邮件失败了,所以 sidekiq 一直坚持不懈的帮你重试..

app/mailers/notify.rb

def self.delay
  delay_for(2.seconds)
end

改成:

def self.delay
  delay_for(2.seconds, :retry => false)
end

应该就好了,但是下次失败就不会重试了... 具体还是要解决自己的 sidekiq 配置问题。这个原因本身还是由于发送异常引起的。

#6 楼 @Saito 其实邮件是发送成功的,但是当它做收尾工作时,报错了……所以就导致程序以为发送失败 Orz……

哎……如果没法解决,就只能暂时改一下了

#5 楼 @zgm 我现在的表情就和你的头像一样

#6 楼 @Saito 暂时先这样改了,先去排查一下sidekiq的配置,thx #7 楼 @c605 邮件没有发送成功(就只有“忘记密码”的时候发送成功,其他的邮件通知都没发送成功),我就是在检查为什么邮件没发送成功时才找到这个错误。

#6 楼 @Saito 谢谢,我已经按照你说的方法做了,目前运行良好,我会找时间研究一下为什么会出现这个问题的。 #9 楼 @Zernel 我是在检查为什么不停的发邮件的时候看了 sidekiq 的日志发现的错误 Orz ……

#10 楼 @c605 cool!.. 昨天 merge 了一个与发邮件相关的 PR, 你可以看看是否跟你的相关。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号