hMailServer 5.6.8-B2538 Does Not Clean Up Open POP3 Session When Error Received And Ends Session

Use this forum if you want to discuss a problem or ask a question related to a hMailServer beta release.
Post Reply
User avatar
jim.bus
Senior user
Senior user
Posts: 701
Joined: 2011-05-28 11:49
Location: US

hMailServer 5.6.8-B2538 Does Not Clean Up Open POP3 Session When Error Received And Ends Session

Post by jim.bus » 2021-06-03 07:05

This may be a slight error in hMailServer processing of POP3 Transactions.

When a POP3 Session is opened and hMailserver receives an Authentication which fails because the Mailbox is already Locked, hMailServer will truncate the message stream and end the POP3 Session. However, the number of POP3 open sessions does not get updated and remains open. Some minutes later the Open Session count is removed but I do not see in the Logs why it is removed. As to why the Open Session count remains for a period of time possibly is because a 'Quit' command is not sent to hMailServer. But I cannot say that the failure of a Quit Command causes this. This is only what I see in the Logs.

The consequences of this minor issue seem negligible but then I have an extremely small hMailServer implementation with very little traffic.

As the Open Session Count does eventually get reduced, this probably is not a problem to really worry about but it does seem like the count should update sooner when a transaction that processes normally updates right away.

User avatar
mattg
Moderator
Moderator
Posts: 21460
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: hMailServer 5.6.8-B2538 Does Not Clean Up Open POP3 Session When Error Received And Ends Session

Post by mattg » 2021-06-04 00:19

perhaps hmailserver closing the connection doesn't close the thread, and it just times out by itself later...

Check for open connections using Netstat, after hMailserver closes the connection
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

User avatar
jim.bus
Senior user
Senior user
Posts: 701
Joined: 2011-05-28 11:49
Location: US

Re: hMailServer 5.6.8-B2538 Does Not Clean Up Open POP3 Session When Error Received And Ends Session

Post by jim.bus » 2021-06-04 00:54

mattg wrote:
2021-06-04 00:19
perhaps hmailserver closing the connection doesn't close the thread, and it just times out by itself later...

Check for open connections using Netstat, after hMailserver closes the connection
Thanks mattg, that was what I was assuming as it appeared it had to be timing out but I tried to look through the Log Entries and I saw no timeouts. I only saw a Log Entry where hMailServer was 'ending the session'. But the connection must have timed out at some point since the Open Session count did reduce sometime afterwards. I do know it was the Session in question because I only had 1 POP3 Session going and I don't have that many email transactions at any one time.

Oh, and that was the point too. hMailServer never closed the connection. hMailServer only ended the session. That was why I thought this might have been a minor error with hMailServer not cleaning up everything at the end of the session.

User avatar
mattg
Moderator
Moderator
Posts: 21460
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: hMailServer 5.6.8-B2538 Does Not Clean Up Open POP3 Session When Error Received And Ends Session

Post by mattg » 2021-06-04 03:37

connections get left open to time out on their own for a number of reasons, including internet connections dropping out, or spammers/hackers just dropping connections rather than closing them.

Perhaps in the case, it is the other way around, and hmailserver just drops the connection but the mail client at the other end is intended to close the connection as they initiated the connection

At any rate, I wouldn't be too stressed, unless you think that the number of open but dropped connections is likely to cause you performance issues
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

User avatar
jim.bus
Senior user
Senior user
Posts: 701
Joined: 2011-05-28 11:49
Location: US

Re: hMailServer 5.6.8-B2538 Does Not Clean Up Open POP3 Session When Error Received And Ends Session

Post by jim.bus » 2021-06-04 03:56

mattg wrote:
2021-06-04 03:37
connections get left open to time out on their own for a number of reasons, including internet connections dropping out, or spammers/hackers just dropping connections rather than closing them.

Perhaps in the case, it is the other way around, and hmailserver just drops the connection but the mail client at the other end is intended to close the connection as they initiated the connection

At any rate, I wouldn't be too stressed, unless you think that the number of open but dropped connections is likely to cause you performance issues
In this case (and funny thing the issue just occurred again as I was reading your Post), Outlook was in the process of doing a Send/Receive of my Email Accounts on hMailServer and the message as with the one that triggered this inquiry to Forum, was that the Milbox was already locked. This not an unusual occurrence because this frequently happens when my Cell Phone does its Receive from hMailServer. But an Error is generated, the Read operation fails. butes tramsferred are 0, and Message Stream is truncated. Then you see an 'Ending session' message. That POP3 Session Count is still showing but will probably eventually go to zero in a bit.

As I've said this seems to be a very minor issue and I do not believe it impacts my installation as I don't have that high a volume of transactions. It just seemed like hMailServer wasn't cleaning up after itself when it should know that it was failing and not an external connection that was failing since it found the Mailbox locked although it was a different connection (Cell Phone connection probably) that caused the mailbox to be locked.

See this portion of my Logs (and I am showing all my logs for the relevant time period):

POP3D" 5132 1409 "2021-06-03 18:40:55.518" "192.168.2.1" "RECEIVED: CAPA"
"POP3D" 5132 1409 "2021-06-03 18:40:55.519" "192.168.2.1" "SENT: +OK CAPA list follows[nl]USER[nl]UIDL[nl]TOP[nl]."
"POP3D" 5128 1409 "2021-06-03 18:40:55.520" "192.168.2.1" "RECEIVED: USER user@domain.com"
"POP3D" 5128 1409 "2021-06-03 18:40:55.520" "192.168.2.1" "SENT: +OK Send your password"
"POP3D" 4656 1409 "2021-06-03 18:40:55.521" "192.168.2.1" "RECEIVED: PASS ***"
"POP3D" 4656 1409 "2021-06-03 18:40:55.536" "192.168.2.1" "SENT: -ERR Your mailbox is already locked"
"DEBUG" 5132 "2021-06-03 18:40:55.537" "The read operation failed. Bytes transferred: 0 Remote IP: 192.168.2.1, Session: 1409, Code: 1, Message: stream truncated"
"DEBUG" 5132 "2021-06-03 18:40:55.537" "Ending session 1409"
"DEBUG" 5128 "2021-06-03 18:40:55.588" "Creating session 1411"

Post Reply