Defect #15025
openReceive IMAP error on empty mailbox
0%
Description
From #14101#note-3.
sudo -u redmine bundle exec rake -f /var/lib/redmine/Rakefile redmine:email:receive_imap RAILS_ENV="production" host=imap.yandex.ru ssl=YES username=username@dezigner.ru password=password project=project1 no_permission_check=1 unknown_user=accept port=993 --trace ** Invoke redmine:email:receive_imap (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute redmine:email:receive_imap rake aborted! undefined method `[]' for nil:NilClass /usr/lib64/ruby/1.9.1/net/imap.rb:1332:in `block in search_internal' /usr/lib64/ruby/1.9.1/monitor.rb:211:in `mon_synchronize' /usr/lib64/ruby/1.9.1/net/imap.rb:1326:in `search_internal' /usr/lib64/ruby/1.9.1/net/imap.rb:757:in `uid_search' /var/lib/redmine/lib/redmine/imap.rb:32:in `check' /var/lib/redmine/lib/tasks/email.rake:141:in `block (3 levels) in <top (required)>' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:236:in `call' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:231:in `each' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain' /usr/lib64/ruby/1.9.1/monitor.rb:211:in `mon_synchronize' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:106:in `each' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:75:in `run' /var/lib/redmine/vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/bin/rake:33:in `<top (required)>' /var/lib/redmine/vendor/bundle/ruby/1.9.1/bin/rake:23:in `load' /var/lib/redmine/vendor/bundle/ruby/1.9.1/bin/rake:23:in `<main>' Tasks: TOP => redmine:email:receive_imap
Configuration:
Environment: Redmine version 2.3.3.stable Ruby version 1.9.3-p448 (2013-06-27) [x86_64-linux] Rails version 3.2.13 Environment production Database adapter Mysql2 Redmine plugins: no plugin installed
Updated by Jean-Philippe Lang about 11 years ago
- Resolution set to Cant reproduce
Updated by Danila Sukharev over 10 years ago
Still reproducible for me.
Rakefile --trace redmine:email:receive_imap RAILS_ENV="production" host=imap.yandex.ru port=993 ssl=1 username=XXX@XXX.XX password=XXX project=xxx
Environment: Redmine version 2.4.3.stable Ruby version 1.8.7-p358 (2012-02-08) [x86_64-linux] Rails version 3.2.16 Environment production Database adapter Mysql2 SCM: Subversion 1.6.11 Git 1.7.4.1 Filesystem Redmine plugins: no plugin installed
** Invoke redmine:email:receive_imap (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute redmine:email:receive_imap rake aborted! undefined method `[]' for nil:NilClass /usr/local/ruby1.8.7ee/lib/ruby/1.8/net/imap.rb:1184:in `search_internal' /usr/local/ruby1.8.7ee/lib/ruby/1.8/monitor.rb:242:in `synchronize' /usr/local/ruby1.8.7ee/lib/ruby/1.8/net/imap.rb:1178:in `search_internal' /usr/local/ruby1.8.7ee/lib/ruby/1.8/net/imap.rb:686:in `uid_search' /home/mambet/webapps/redmine2/redmine/lib/redmine/imap.rb:32:in `check' /home/mambet/webapps/redmine2/redmine/lib/tasks/email.rake:125 /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/lib/rake/task.rb:236:in `call' /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/lib/rake/task.rb:236:in `execute' /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/lib/rake/task.rb:231:in `each' /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute' /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/lib/rake/task.rb:175:in `invoke_with_call_chain' /usr/local/ruby1.8.7ee/lib/ruby/1.8/monitor.rb:242:in `synchronize' /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain' /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke' /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/lib/rake/application.rb:149:in `invoke_task' /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/lib/rake/application.rb:106:in `top_level' /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/lib/rake/application.rb:106:in `each' /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/lib/rake/application.rb:106:in `top_level' /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/lib/rake/application.rb:115:in `run_with_threads' /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/lib/rake/application.rb:100:in `top_level' /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/lib/rake/application.rb:78:in `run' /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling' /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/lib/rake/application.rb:75:in `run' /home/mambet/webapps/redmine2/gems/gems/rake-10.1.1/bin/rake:33 /home/mambet/webapps/redmine2/bin/rake:19:in `load' /home/mambet/webapps/redmine2/bin/rake:19 Tasks: TOP => redmine:email:receive_imap
Updated by Sunding Wei about 10 years ago
Reproducible for me, I tested on 2.3-stable, 2.5-stable and master, using a empty mail box, would you please fix this?
#!/bin/sh rake \ -f /home/website/redmine/Rakefile \ --trace \ redmine:email:receive_imap \ RAILS_ENV="production" \ host=imap.qq.com username=redmine@dingding.company password=xxxxx
Error
root@R720:/home/website/redmine# ./check_mail.sh ** Invoke redmine:email:receive_imap (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute redmine:email:receive_imap rake aborted! NoMethodError: undefined method `[]' for nil:NilClass /usr/lib/ruby/1.9.1/net/imap.rb:1332:in `block in search_internal' /usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize' /usr/lib/ruby/1.9.1/net/imap.rb:1326:in `search_internal' /usr/lib/ruby/1.9.1/net/imap.rb:757:in `uid_search' /home/website/redmine/lib/redmine/imap.rb:32:in `check' /home/website/redmine/lib/tasks/email.rake:128:in `block (4 levels) in <top (required)>' /home/website/redmine/app/models/mailer.rb:367:in `with_synched_deliveries' /home/website/redmine/lib/tasks/email.rake:127:in `block (3 levels) in <top (required)>' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/task.rb:240:in `call' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/task.rb:240:in `block in execute' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/task.rb:235:in `each' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/task.rb:235:in `execute' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain' /usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/task.rb:172:in `invoke_with_call_chain' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/task.rb:165:in `invoke' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:150:in `invoke_task' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:106:in `block (2 levels) in top_level' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:106:in `each' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:106:in `block in top_level' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:78:in `block in run' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:75:in `run' /var/lib/gems/1.9.1/gems/rake-10.3.2/bin/rake:33:in `<top (required)>' /usr/local/bin/rake:23:in `load' /usr/local/bin/rake:23:in `<main>' Tasks: TOP => redmine:email:receive_imap
Updated by Alex Moroz about 10 years ago
2.6-stable also have this error. It reproducing if mailbox is empty.
Updated by Matt O almost 10 years ago
Same here, but only when using SSL/993 on a mailbox with no unread Mails.
Environment: Redmine version 2.6.0.stable Ruby version 1.9.3-p194 (2012-04-20) [x86_64-linux] Rails version 3.2.19 Environment production Database adapter PostgreSQL
Updated by Anguo Zhao over 9 years ago
/usr/share/redmine/lib/redmine/imap.rb
Line 32:
...
imap.select(folder)
+ begin
+ unreadmessages = imap.uid_search(['NOT', 'SEEN'])
+ puts unreadmessages if unreadmessages.length > 0
+ rescue
+ puts "No new message..."
+ exit
+ end
+ unreadmessage.each do |uid|
- imap.uid_search(['NOT', 'SEEN']).each do |uid|
...
Updated by Mihai Kelemen over 6 years ago
I can confirm the same behavior: using SSL on 993 (with SmarterMail) with no unread emails, throws error 500.
NoMethodError (undefined method `[]' for nil:NilClass): lib/redmine/imap.rb:36:in `check' ...
For the moment I'm using the solution proposed by Anguo Zhao in his comment above, with a note: instead of unreadmessage.each do |uid| should read unreadmessages.each do |uid|
Later edit: works with GSuite.