imapclient icon indicating copy to clipboard operation
imapclient copied to clipboard

Any other command than `DONE` while in idle hangs

Open NicolasLM opened this issue 7 years ago • 4 comments

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 ...

NicolasLM avatar Aug 23 '17 12:08 NicolasLM

Yep. We should fix this.

mjs avatar Aug 29 '17 09:08 mjs

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.

NicolasLM avatar Oct 02 '17 11:10 NicolasLM

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.

kevinpthorne avatar Aug 05 '19 17:08 kevinpthorne

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.

mjs avatar May 21 '20 10:05 mjs