-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
idle_done() Hangs When Network Connection Severed #449
Comments
Thanks for the detailed report. I’ll take a look. |
If you need any more information for testing, just let me know. Thanks for taking a look! |
I can reproduce this issue, and the traceback suggests that it was stuck waiting for a response in line 975 from imapclient/imapclient/imapclient.py Lines 973 to 975 in 0279592
This means the I believe the receiving part is expected behaviour that can be configured with I am uncertain whether |
Sorry for my slow responses. I don't have much spare time these days. My guess would be that if the server kills the connection such that a TCP reset arrives at the client, the read should fail because the client OS will terminate the connection. If packets between the server and client are just dropped then I could see idle_done getting stuck (and other commands too). This is somewhat expected. When packets are dropped it is impossible to distinguish a slow connection from a broken one. Using a socket timeout is probably the best approach to deal with this kind of thing. Can you think of anything that IMAPClient should be doing differently? Maybe a generous timeout should be the default? |
So, like a
Nothing really comes to mind in terms of changing behaviour. And I am not sure there is a sensible default, with varying use cases. I would suggest a "no defeault" instead, to force the user to acknowledge that they have picked something, but that breaks existing code. As for what can be changed... I am not sure. The only thing that comes to mind is, may be remind the user of the timeout in the documentation of |
While trying to find a good way to detect when there is no network connection while in a idle_check() loop, I discovered that if the network connection to the IMAP server is severed after idle() has been called, a call to idle_close() just hangs unless the network connection is restored.
The purpose of stopping the IDLE state and restarting it every 30 seconds is to ensure a connection to the IMAP server still exists since idle_check() does not detect a connection loss.
Steps to Reproduce
Code Output
My Setup
The text was updated successfully, but these errors were encountered: