Possible bug in POP3 Library

GOINT

Member
Licensed User
Longtime User
Hello folks,

I think that there is a small bug in the POP3 funtion of Net library, or at least in the sample code.

The problem happens when you try to retrieve messages from an inbox that has more than 20 messages. The sample code calls pop.DownloadMessage(Messages.GetKeyAt(i), False) for every message, and that causes more than 20 threads to run simultaneously, so you get this error:

java.util.concurrent.RejectedExecutionException

That happens because the POP_DownloadCompleted event is not being fired fast enough. If you try the same code with an inbox that has 20 messages or less then everything works.

Of course, a possible workaround would be to ask for the 1st message, wait for the download to complete, then ask for the 2nd message, etc.

Thanks!
Joe
 

William Hunter

Active Member
Licensed User
Longtime User
POP3 Errors

Each call to DownloadMessage sends a task request to the internal thread pool. You cannot have more than 20 tasks at the same time.

The solution is to download the messages one after another.

Hello Erel - I believe that I have something to add here, which may be of interest to others. I have been working on an app for purging junk mail from a POP3 server. Initially I had a litany of error problems.

I wanted the ability to delete more than 20 messages in one run, along with auto re-login after deletions. I would have problems with re-login; the server would be busy. Or, I would get a threading error. It was difficult to differentiate between errors caused by my coding mistakes, or those from server errors. I persisted.

In resolution of these errors, I have found that a one second delay after each message deleted, lets me delete more than twenty messages in one run without error. I realize that it would be unusual to have the need to delete this many messages in one run. But, who knows, the user might have been touring the Himalayas for a month or so. Should they return to a junk mail over-run inbox, my app has to be able to deal with this.

I pass this along with the thought of being helpful to others. :)
 
Top