Imap ProtocolError with GMail

0 votes
asked Feb 13, 2012 by IronBy (160 points)
edited Feb 27, 2012

Hello We use imap library and encountered the following error:

Rebex.Net.ImapException: System error (Failure) (NO).
   at Rebex.Net.Imap.BboyfsZ(String , ImapResponse , Boolean )
   at Rebex.Net.Imap.SelectFolder(String folder, Boolean readOnly)
...
Conditions:
Server: Gmail
Error status: 'ProtocolError'
ConnectionState: connected
ConnectionState.NativeErrorCode: '0'
Client.State: 'Ready'
SelectedFolder: 'Inbox'
Application: ASP.NET

The error occurs not constantly. The code check for a new messages once a minute.

Also right after the error occured we can't do anything through imap as we get:

   System.InvalidOperationException: No folder is selected.
   at Rebex.Net.Imap.Search(ImapMessageSet messageSet, ImapListFields fields, ImapSearchParameter[] parameters)

although we had selected a folder before without errors.

Only iisreset helps us. Can you help us with that?

Applies to: Rebex Secure Mail

3 Answers

0 votes
answered Feb 13, 2012 by Tomas Knopp (58,890 points)
edited Feb 24, 2012

Hello

we need to see the log of the communication, please create it as described at http://www.rebex.net/kb/logging.aspx

and send us the file to support@rebex.net so that we are able to investigate your issue.

By the way, instead of iisreset you could definitely dispose the Imap object and then initialize it again. That should do. You don't have to restart the whole web server.

commented Feb 24, 2012 by IronBy (160 points)
edited Feb 24, 2012

I sent you logs to the email. Have you got it?

commented Feb 24, 2012 by Jan Sotola (16,920 points)
edited Feb 24, 2012

My colleague made a typo - the right address is support@rebex.net. However, no logs have come from you to any of the two addresses. Could you please resend the logs to the support@rebex.net?

commented Feb 24, 2012 by Jan Sotola (16,920 points)
edited Feb 24, 2012

We've already found the original e-mail. We'll analyze the logs either today afternoon or on Monday.

commented Feb 24, 2012 by IronBy (160 points)
edited Feb 24, 2012

Am I correct I don't need resend the logs?

commented Feb 24, 2012 by Jan Sotola (16,920 points)
edited Feb 24, 2012

Yes, correct.

0 votes
answered Feb 24, 2012 by Lukas Pokorny (101,070 points)
edited Feb 24, 2012

Unfortunately, Gmail's IMAP servers are known to report this "System error (Failure)" error occasionally for no apparent reason. Even Mark Crispin, the guy who actually created the IMAP protocol, criticised Google for it few years ago, and apparently, it has not been entirely solved since then. Re-trying the operation again usually succeeds, even though the actual command used is identical to the one issued before the error was reported, which also confirms that something is wrong at the server side, not the client side.

A workaround for this server bug is to retry the operation. If that doesn't help, disconnect and connect/login to the server again.

The "No folder is selected" error seems to be caused because you called Imap.Search method after reconnecting to the server without calling Imap.SelectFolder first. Imap.Search and many other methods such as GetMessageList, GetMessageInfo or GetMailMessage will only work after a folder has been selected.

0 votes
answered Feb 27, 2012 by IronBy (160 points)
edited Feb 27, 2012

Thank you very much.

...