IdleLoop Exception
I've spent quite a while trying to replicate this issue, but I can't get a solid result.
Locally, this works perfectly fine (debugging via Visual Studio). I can let in run overnight without a problem.
When we deploy to azure, however, we get errors every 15-20minutes or so.
This is the exception:
Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond *** Stacktrace *** at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count) at System.Net.Security._SslStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslStream.Read(Byte[] buffer, Int32 offset, Int32 count) at System.IO.Stream.ReadByte() at S22.Imap.ImapClient.GetResponse(Boolean resolveLiterals) in d:\S22.Imap\ImapClient.cs:line 512 at S22.Imap.ImapClient.IdleLoop() in d:\S22.Imap\ImapClient.cs:line 2092
The email code runs in a separate thread from the main thread. It simply subscribes to the events dispatched by ImapClient.
I have no idea why it only happens on Azure, however. This is connecting to a gmail account (both locally and live point to the same inbox, as well).
The problem is that a socket read has an internal I/O timeout that expires due to a lack of untagged responses being sent by the server during the IDLE session.
Unfortunately, this won't be trivial to fix in S22.Imap. You could set an infinite timeout but that cause other problems with the way that the IDLE loop works.
I would recommend using MailKit instead because the problem doesn't exist there.
I switched to MailKit instead of S22.Imap because of this. Too bad there's no solution.
Any work going on this still? I am planning to use this dll for processing new emails.
Latest commit 874de53 on 27 Jan 2014
I don't think this project is still alive, I've switched to https://github.com/jstedfast/MailKit and it works great so far.
Okay @kipusoep Many thanks for the info