Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

store.connect Hangs Randomly Despite Timeout

843834Dec 22 2007 — edited Jan 5 2008
My JavaMail program connects to my POP3 server 99% of the time but occasionally (and unpredictably) hangs when it attempts to connect. I have set the timeouts as follows:

java -Dmail.pop3.connectionTimeout=5000 -Dmail.pop3.timeout=60000 shmoops.Shmoops

Here is a code excerpt:
Store store = null;
    Folder folder = null;

    Session session = getSession();

    System.out.println("About to call session.getStore.");
    store = session.getStore("pop3");
    System.out.println("About to call store.connect.");
    store.connect(pop3Host, -1, userName, password);
    setStore(store);
I have debugging turned on and have some printlns; here is the output:
Received 0 mail messages.
About to call session.getStore.
DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.
POP3Store,Sun Microsystems, Inc]
About to call store.connect.
DEBUG POP3: connecting to host "shmoops.com", port 110, isSSL false
S: +OK ArGoSoft Mail Server Pro for WinNT/2000/XP, Version 1.8 (1.8.8.7)
C: USER seinfeld@shmoops.com
S: +OK Password required for seinfeld@shmoops.com
C: PASS delores
S: +OK Mailbox locked and ready
About to call store.getDefaultFolder.
About to call folder.getFolder.
About to call folder.open.
C: STAT
S: +OK 0 0
About to call folder.getMessageCount.
About to exit mailSession.openMailbox.
C: QUIT
S: +OK Aba he
Received 0 mail messages.
About to call session.getStore.
DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.
POP3Store,Sun Microsystems, Inc]
About to call store.connect.
DEBUG POP3: connecting to host "shmoops.com", port 110, isSSL false
S: +OK ArGoSoft Mail Server Pro for WinNT/2000/XP, Version 1.8 (1.8.8.7)
C: USER seinfeld@shmoops.com
S: +OK Password required for seinfeld@shmoops.com
C: PASS delores
S: +OK Mailbox locked and ready
About to call store.getDefaultFolder.
About to call folder.getFolder.
About to call folder.open.
C: STAT
S: +OK 0 0
About to call folder.getMessageCount.
About to exit mailSession.openMailbox.
C: QUIT
S: +OK Aba he
Received 0 mail messages.
About to call session.getStore.
DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.
POP3Store,Sun Microsystems, Inc]
About to call store.connect.
DEBUG POP3: connecting to host "shmoops.com", port 110, isSSL false
Note that the hang occurs while connecting to the host; store.connect never returns. Any thoughts about why this hang would occur?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 2 2008
Added on Dec 22 2007
8 comments
413 views