imapclient
imapclient copied to clipboard
Any other command than `DONE` while in idle hangs
Issuing a LOGOUT
while in IDLE
makes the process hang. It is an invalid sequence in IMAP (the only command acceptable while in idle is DONE
), but still IMAPClient should not hang waiting for a response that will never arrive.
c = imapclient.IMAPClient(host="host")
c.login("user", "pass")
c.select_folder("INBOX")
c.idle()
c.logout()
2017-08-23 13:59:44,655 - DEBUG: > b'DCEI3 IDLE'
2017-08-23 13:59:44,690 - DEBUG: < b'+ idling'
2017-08-23 13:59:44,690 - DEBUG: > b'DCEI4 LOGOUT'
2017-08-23 13:59:44,724 - DEBUG: < b'DCEI3 BAD Expected DONE.'
2017-08-23 13:59:44,724 - DEBUG: BAD response: b'Expected DONE.'
... Process hanging here ...
Yep. We should fix this.
Not critical and I assume this kind of error will be caught very early on in the development process, so moving it to milestone 3.0.0
.
Just ran into this, simple fix was to do idle_done()
, do the other commands, then go back to idle
. Luckily I found this ticket after some googling.
This could certainly be made friendlier but in a way that would pollute all the command methods.
The most pragmatic approach is probably to improve the documentation.