1
SmarterMail does not receive mail after service start
Problem reported by Bryan Zimmerman - 2/24/2024 at 9:35 AM
Submitted
For about the past 6 months as well through a sever rebuild, I have run into the issue of after a reboot the SmarterMail service starts but sometimes does not receive mail.  However, the web interface works fine.  

After not receiving mail for some time, restarting the service will successfully start to receive mail. 

Just recently I have also experienced receiving mail and then mail reception stops without a server reboot which requires restarting the service.

After the recent happening yesterday.  Searching through the logs only revealed the following:

09:05:05.448 smtp stopped at 2/23/2024 9:05:05 AM
09:14:23.979 smtp started at 2/23/2024 9:14:23 AM
09:14:23.993 [10.10.0.50:25] Binding(2) Exception: System.Net.Sockets.SocketException (10049): The requested address is not valid in its context.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
09:14:23.993 [10.10.0.50:587] Binding(2) Exception: System.Net.Sockets.SocketException (10049): The requested address is not valid in its context.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
09:14:23.994 [10.10.0.50:465] Binding(2) Exception: System.Net.Sockets.SocketException (10049): The requested address is not valid in its context.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
21:52:16.334 System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at SmarterMail.Protocols.Common.PooledTcpServer.Listener()
21:52:16.334 smtp stopped at 2/23/2024 9:52:16 PM
21:53:01.892 smtp started at 2/23/2024 9:53:01 PM
21:53:01.898 [127.0.0.1:25] Binding(2) Exception: System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
21:53:01.899 [127.0.0.1:587] Binding(2) Exception: System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
21:53:01.899 [127.0.0.1:465] Binding(2) Exception: System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
21:53:01.900 [fd03:cd22:4796:9a9d::32:25] Binding(2) Exception: System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
21:53:01.900 [fd03:cd22:4796:9a9d::32:587] Binding(2) Exception: System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
21:53:01.900 [fd03:cd22:4796:9a9d::32:465] Binding(2) Exception: System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
21:53:01.900 [::1:25] Binding(2) Exception: System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
21:53:01.901 [::1:587] Binding(2) Exception: System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
21:53:01.901 [::1:465] Binding(2) Exception: System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
Even more puzzling is that I was able to send email during the period that I could not receive.  Has anyone else experienced these issues.

8 Replies

Reply to Thread
0
Bryan Zimmerman Replied
Yes, only one program can usually bind to a port as a server but multiple can bind as a client.  Anyway, this is a very simple server with the following important components:

1. Windows Server 2022 Standard
2. IIS
3. Simple DNS
4. SmarterMail
5. ESET Server Security

If I set the SmartMail service to manual and reboot the machine, then run the following upon reboot:

netstat -a -b -f -o | findstr :25
There are 0 results meaning no connections to port 25.

If I then start the SmarterMail service and rerun the command I get the following:

  TCP    10.10.0.50:25          My-Server.com:0           LISTENING       12440
  TCP    10.10.0.50:25          gravir.asquasi.com:57802  ESTABLISHED     12440
  TCP    127.0.0.1:25           My-Server.com:0           LISTENING       12440
  TCP    [::1]:25               My-Server.com:0           LISTENING       12440
  TCP    [fd03:cd22:4796:9a9d::32]:25  My-Server.com:0    LISTENING       12440
Running a few minutes later
  TCP    10.10.0.50:25          My-Server.com:0                LISTENING       12440
  TCP    10.10.0.50:25          128.hosted-by.198xd.com:8560   TIME_WAIT       0
  TCP    10.10.0.50:25          128.hosted-by.198xd.com:18696  TIME_WAIT       0
  TCP    10.10.0.50:25          128.hosted-by.198xd.com:28146  TIME_WAIT       0
  TCP    10.10.0.50:25          128.hosted-by.198xd.com:34352  ESTABLISHED     12440
  TCP    10.10.0.50:25          128.hosted-by.198xd.com:37742  TIME_WAIT       0
  TCP    10.10.0.50:25          128.hosted-by.198xd.com:43976  TIME_WAIT       0
  TCP    10.10.0.50:25          128.hosted-by.198xd.com:47130  TIME_WAIT       0
  TCP    10.10.0.50:25          128.hosted-by.198xd.com:53488  TIME_WAIT       0
  TCP    10.10.0.50:25          128.hosted-by.198xd.com:63512  TIME_WAIT       0
  TCP    127.0.0.1:25           My-Server.com:0                LISTENING       12440
  TCP    [::1]:25               My-Server.com:0                LISTENING       12440
  TCP    [fd03:cd22:4796:9a9d::32]:25  My-Server.com:0         LISTENING       12440
I find it very odd that SmarterMail is opening ports to Romania https://www.ip-tracker.org/lookup.php?ip=45.129.14.128
1
Douglas Foster Replied
You misunderstand ports.   Every connection has a initiator / client port ( usually chosen randomly from 10000+ to insure uniqueness ) and a listener / server port (usually chosen from a well-known list based on service).   Multiple clients can have connections to the same server port but no port can be owned by more than one process    You need to figure out why the IP+port combination is not valid at system startup.  Trust your logs 
1
Charalampos Michael Replied
My situation is that it doesn't allow connections on service start i have to restart the service 2nd time in order to work.
0
Bryan Zimmerman Replied
I do understand ports as I program them.  Smarter Mail is creating a TCP server on port 25.

After Black Listing the following IP'S:
1. 45.129.14.128 128.hosted-by.198xd.com
2. 141.98.11.95 srv-141-98-11-95.serveroffer.net

Which were performing Password Brute Force by Email as well as tightening the IDS rules I performed the following test.

1. Stop SmarterMail Service
2. Verify no port 25 activity via
netstat -a -b -f -o | findstr :25
3. Start SmarterMail Service
4. Verify Listening ports opened via SmarterMail

Out of 5 sequences I had 4 successes and 1 failure where the ports did not open representing a 20% failure rate.  This indicates an issue somewhere in SmarterMail.


0
Kyle Kerst Replied
Employee Post
@Bryan: Do you find any exceptions or other errors noted in the Event Viewer when the ports fail to bind? Also, in between these sequence tests; are you verifying MailService.exe has completely dropped from the Task Manager before starting the service again? Or is this happening only on reboots? If this is just with service startup/restarts - I'd have concern that the previously bound/listening ports might still be in memory as they take a little time to unload and unbind at shutdown in some environments. 
Kyle Kerst IT Coordinator SmarterTools Inc. www.smartertools.com
0
Bryan Zimmerman Replied
Sorry for the delay.  So I cleared all the event logs, and performed the following.

1. Stop SmarterMail Service
2. netstat for port 25
3. See if service went away in task manager
4. netstat again for port 25
5. start SmarterMail Service
6. netstat for port 25

After repeating this 15 times, I could not recreate the situation today.  I did confirm that the service has to be removed from task manager before netstat will not show the ports in use.

The issue definitely seems more boot related than warm restart related.

0
Bryan What version of SmarterMail, and are you running any other software on this machine or is it dedicated to email ?  Are you running anything like plesk or databases, websites, wordpress, or anything else ?  Look at your startup programs and see what they are and maybe have them on delayed start. I know a lot of software on boot tries to go out and look for updates and sometimes sends reports and feedback.
I have seen in the past that plesk was interfering with the "MailService" task and killing it. I would occasionally have to restart it.  After i upgraded both to the latest versions that went away.
www.HawaiianHope.org - Providing technology services to non profit organizations, low income families, homeless shelters, clean and sober houses and prisoner reentry programs. Since 2015, We have refurbished over 11,000 Computers !
0
Bryan Zimmerman Replied
I am using build 8832 as of today.  During 3 reboots I had a failure twice where the service properly failed to initialize to receive mail.  What I mean by that is the following:

1. netstat shows that only the loopback addresses were bound as a server, i.e. 127.0.0.1 & ::1
2. errors were indicated in the smptLog indicating failure to bind to assigned addresses, i.e.
09:31:04.925 [10.10.0.50:25] Binding(2) Exception: System.Net.Sockets.SocketException (10049): The requested address is not valid in its context.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
09:31:04.925 [10.10.0.50:587] Binding(2) Exception: System.Net.Sockets.SocketException (10049): The requested address is not valid in its context.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
09:31:04.925 [10.10.0.50:465] Binding(2) Exception: System.Net.Sockets.SocketException (10049): The requested address is not valid in its context.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
09:31:04.929 [fd03:cd22:4796:9a9d::32:25] Binding(2) Exception: System.Net.Sockets.SocketException (10049): The requested address is not valid in its context.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
09:31:04.930 [fd03:cd22:4796:9a9d::32:587] Binding(2) Exception: System.Net.Sockets.SocketException (10049): The requested address is not valid in its context.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
09:31:04.930 [fd03:cd22:4796:9a9d::32:465] Binding(2) Exception: System.Net.Sockets.SocketException (10049): The requested address is not valid in its context.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at SmarterMail.Protocols.Common.PooledTcpServer.StartListening(IPEndPoint ipEndPoint, db_system_binding_port bindingPort)
3. No errors indicated in event viewer
4. SmarterMail Troubleshooting indicates no issues

The main issue here is not that it fails to start but that it is basically a silent failure!  There is no indication to the Domain Adminstrators web mail or in the SysAdmin console of any problems.  Only searching the logs or doing a netstat would indicate a problem with the system.

Also why is failure to bind to sockets not retried on a periodic interval until successful?

Reply to Thread