From: Bob Potter Date: 2010-01-29T10:57:20+09:00 Subject: [ruby-core:27944] [Bug #2683] IMAP hangs when receiving an unexpected "BYE" during login Bug #2683: IMAP hangs when receiving an unexpected "BYE" during login http://redmine.ruby-lang.org/issues/show/2683 Author: Bob Potter Status: Open, Priority: Normal ruby -v: ruby 1.9.2dev (2009-07-18 trunk 24186) [x86_64-linux] The main imap thread will hang if the receiving thread receives an unexpected "BYE" message during login. IMAP#receive_responses (lines 1054-7) sets the exception correctly but fails to break out of the main reading loop because 'break' is called inside of a block. During the next pass through the loop, an exception will be raised causing the receiving thread to die and the main thread to hang indefinitely. I've attached a patch and a test case. The test case should hang with the latest net/imap.rb but pass with the attached patch. The patch is not very pretty, but I'm hesitant to make any large changes to that method. I'm more than happy to rework the patch if there is a better way to fix it. ---------------------------------------- http://redmine.ruby-lang.org