Patch #14103

Disconnect and logout from IMAP after mail receive

Added by Pierre Pretorius over 4 years ago. Updated over 4 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Email receiving
Target version:2.3.2

Description

When running Redmine::IMAP.check(imap_options, options) in a continuous loop with a delay (I don't want to boot the rails env every time) you will eventually get the error listed below depending on your mail provider's maximum concurrent users:

rake aborted!
 Too many simultaneous connections. (Failure)
/usr/local/lib/ruby/2.0.0/net/imap.rb:1156:in `get_tagged_response'
/usr/local/lib/ruby/2.0.0/net/imap.rb:1210:in `block in send_command'
/usr/local/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/usr/local/lib/ruby/2.0.0/net/imap.rb:1192:in `send_command'
/usr/local/lib/ruby/2.0.0/net/imap.rb:435:in `login'
/home/ppretorius/workspace-ruby/redmine-2.3.1/lib/redmine/imap.rb:30:in `check'

This problem is fixed by simply adding imap.logout and imap.disconnect at the end of the method:

  imap.expunge
  imap.logout
  imap.disconnect

I got the solution from this stackoverflow post.

imap_disconnect.diff Magnifier (398 Bytes) Pierre Pretorius, 2013-05-20 17:12


Related issues

Related to Redmine - Patch #14101: Receive IMAP by uid's Closed

Associated revisions

Revision 11905
Added by Jean-Philippe Lang over 4 years ago

Disconnect and logout from IMAP after mail receive (#14103).

Patch by Pierre Pretorius.

Revision 12001
Added by Jean-Philippe Lang over 4 years ago

Merged r11905 from trunk (#14103).

History

#1 Updated by Etienne Massip over 4 years ago

  • Target version set to Candidate for next major release

Since Redmine handles the connection opening and login, it could/should handle logout and disconnection as well.

#2 Updated by Jean-Philippe Lang over 4 years ago

  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
  • Target version changed from Candidate for next major release to 2.3.2

Patch committed in r11905, thanks.

#3 Updated by Jean-Philippe Lang over 4 years ago

  • Status changed from Resolved to Closed

Merged.

Also available in: Atom PDF