issues@javamail.java.net

Re: Mailserver reports two login/logouts

From: Bill Shannon <bill.shannon_at_sun.com>
Date: Wed, 21 Oct 2009 11:27:35 -0700

getFolder doesn't create a connection, Folder.open does.

Also, if you close the folder and then call Store.isConnected,
it will open a new connection.

Clearly something you're doing is causing the second connection,
but I would need to know more precisely what you're doing. Can
you share the code?

Frank Schruefer wrote on 10/21/09 06:50:
>> Hi Frank. I honestly have no idea what the purpose of the "issues"
>> mailing list is for Kenai projects. These questions are probably
>> better sent to the "users" mailing list, or to one of the JavaMail
>> forums.
>
> Sorry, my dictionary wasn't clear on this, so I thought 'issues' means
> something like problems :-)
>
>>> Im checking mail with javamail 1.4.2 on a pop3 mailserver.
>>> The mailserver logs say that two logins/logouts are made:
>>>
>>> Oct 14 17:02:32 sfmail01 pop3d: Connection, ip=[::ffff:91.66.207.201]
>>> Oct 14 17:02:32 sfmail01 pop3d: LOGIN,
>>> user=webmail.demo_at_siteforum.com, ip=[::ffff:91.66.207.201]
>>> Oct 14 17:02:32 sfmail01 pop3d: LOGOUT,
>>> user=webmail.demo_at_siteforum.com, ip=[::ffff:91.66.207.201], top=0,
>>> retr=0, rcvd=18, sent=49, time=0
>>> Oct 14 17:02:32 sfmail01 pop3d: Connection, ip=[::ffff:91.66.207.201]
>>> Oct 14 17:02:32 sfmail01 pop3d: LOGIN,
>>> user=webmail.demo_at_siteforum.com, ip=[::ffff:91.66.207.201]
>>> Oct 14 17:02:32 sfmail01 pop3d: LOGOUT,
>>> user=webmail.demo_at_siteforum.com, ip=[::ffff:91.66.207.201], top=0,
>>> retr=0, rcvd=6, sent=30, time=0
>>>
>>>
>>> while the connectionlistener only reports two logins/logouts (Printed
>>> the Events to System.err):
>>>
>>> javax.mail.event.ConnectionEvent[source=pop3://helpdesk.demo%40siteforum.com_at_mail.siteforum.com]:
>>> opened.
>>> javax.mail.event.ConnectionEvent[source=pop3://helpdesk.demo%40siteforum.com_at_mail.siteforum.com]:
>>> closed.
>>>
>>>
>>> Any idea why there's a second login/logout happening or how I can
>>> debug this further?
>> Did you see the debugging tips in the JavaMail FAQ?
>
> Thanks, that helped to shed some light what is going on:
> The second connection is obviously opened when the getFolder("INBOX") method
> is called.
>
> This is ok for an IMAP connection as these messages here explain:
> http://forums.sun.com/thread.jspa?threadID=5377355
>
> But I'm using POP3 which doesn't have the concept of folders so the second
> connection would probably be pure overhead.
> And as you can see it's basically just a login/logout with no command in
> between (if I'm reading this right).
>
>
> Here's the log with debug enabled (i also printed out the various events):
> DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]
> DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]
> DEBUG POP3: connecting to host "mail.siteforum.com", port 110, isSSL false
> S: +OK Hello there.
> C: USER webmail.demo_at_siteforum.com
> S: +OK Password required.
> C: PASS xxxxxxxx
> S: +OK logged in.
> C: STAT
> [DEBUG-MAIL] Connection opened (javax.mail.event.ConnectionEvent[source=pop3://webmail.demo%40siteforum.com_at_mail.siteforum.com]).
> S: +OK 0 0
> [DEBUG-MAIL] Connection opened (javax.mail.event.ConnectionEvent[source=INBOX]).
> C: NOOP
> S: +OK Yup.
> C: QUIT
> S: +OK Bye-bye.
> [DEBUG-MAIL] Connection closed (javax.mail.event.ConnectionEvent[source=INBOX]).
> DEBUG POP3: connecting to host "mail.siteforum.com", port 110, isSSL false
> S: +OK Hello there.
> C: USER webmail.demo_at_siteforum.com
> S: +OK Password required.
> C: PASS xxxxxxxx
> S: +OK logged in.
> C: QUIT
> S: +OK Bye-bye.
> [DEBUG-MAIL] Connection closed (javax.mail.event.ConnectionEvent[source=pop3://webmail.demo%40siteforum.com_at_mail.siteforum.com]).
>
>
> BTW: It would be a good idea if the debug trace would come with some kind of connection id as
> this all seems to be a bit mixed up (at least in combination with the events).
>