【发布时间】:2014-04-13 05:18:01
【问题描述】:
我登录到 IMAP 服务器:
imap = Net::IMAP.new("imap.gmail.com")
imap.login("username", "password")
imap.select("inbox")
然后我使用 IMAP IDLE 在邮件到来时获取邮件。由于 imap 服务器连接在 30 分钟后自动断开,我每 25 分钟重新连接到 IMAP 服务器。
所有这些都可以正常工作,直到持续超过 48 小时。当我执行 imap.logout
时出现以下错误错误信息:
IOError closed stream - ["org/jruby/ext/openssl/SSLSocket.java:664:in `syswrite'",
"/opt/jruby-1.7.6/lib/ruby/shared/jopenssl19/openssl/buffering.rb:318:in `do_write'",
"/opt/jruby-1.7.6/lib/ruby/shared/jopenssl19/openssl/buffering.rb:415:in `print'",
/opt/jruby-1.7.6/lib/ruby/1.9/net/imap.rb:1210:in `put_string'",
"/opt/jruby-1.7.6/lib/ruby/1.9/net/imap.rb:1182:in `send_command'",
"/opt/jruby-1.7.6/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'",
"/opt/jruby-1.7.6/lib/ruby/1.9/monitor.rb:210:in `mon_synchronize'",
"/opt/jruby-1.7.6/lib/ruby/1.9/net/imap.rb:1177:in `send_command'",
"/opt/jruby-1.7.6/lib/ruby/1.9/net/imap.rb:352:in `logout'"
imap 对象:
#, raw_data="* OK Gimap 准备好接受来自 54.242.66.175 v74mb152689693qgv\r\n">, @mon_owner=nil, @client_thread=#, @tagged_response_arrival=#, @cond=#> 的请求, @sock =#>,@ sync_close =真,@ rbuffer = “”,@主机名= “”,@ IO =#,@ SYNC = TRUE,@ wbuffer =“RUBY0041 LOGOUTRUBY0042 LOGOUTRUBY0043 LOGOUTRUBY0044 LOGOUTRUBY0045 LOGOUTRUBY0046 LOGOUTRUBY0047 LOGOUTRUBY0048 LOGOUTRUBY0049 LOGOUTRUBY0050 LOGOUTRUBY0051 LOGOUTRUBY0052 LOGOUTRUBY0053 LOGOUTRUBY0054 LOGOUTRUBY0055 LOGOUT">,@tagno=55,@tagged_responses={},@host="imap.gmail.com",@exception=nil,@usessl=true,@port=993,@tag_prefix="RUBY", @mon_count=0, @receiver_thread=#, @responses={"FLAGS"=>[[:Answered, :Flagged, :Draft, :Deleted, :Seen, "$Phishing", "$NotPhishing"]], "OK "=>[#, text="Flags allowed.">, #, text=" UIDs valid.">, #, text=" Predicted next UID.">, #, text="">], "PERMANENTFLAGS" =>[[:Answered, :Flagged, :Draft, :Deleted, :Seen, "$Phishing", "$NotPhishing", :*]], "UIDVALIDITY"=>[651870578], "EXISTS"=>[1661 ], "最近"= >[0], "UIDNEXT"=>[1835], "HIGHESTMODSEQ"=>["288129"], "BYE"=>[#]}, @response_handlers=[], @continuation_request_arrival=#, @cond=# >, @receiver_thread_terminating=false, @logout_command_tag="RUBY0040", @debug_output_bol=true, @parser=#true, :Flagged=>true, :Draft=>true, :Deleted=>true, :Seen=>true, : *=>true}, @token=nil, @str="RUBY0040 OK 73 good day (Success)\r\n">, @mon_mutex=#, @idle_done_cond=#, @cond=#>>
谁能解释为什么会这样?
【问题讨论】: