Is there a condition or state that Postfix can enter that will prevent connectivity on port 25?
Am using Javamail to send to postfix as the local MTA, which works about 99% of the time. However, I will occassionally see an exception like:
javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
nested exception is:
java.net.ConnectException: Connection refused
So, is it possible one of the queues is filling up and causing this? Is there a state Postfix could be in that will actively refuse a local connection?
Thanks in advance!
Connection refused usually means that the service is not listening on that port. In your case postfix was not running when you have seen that exception.
If postfix is to slow you will receive a timeout exception.
When an application is slow and is listening, the TCP connection will be established by the TCP subsystem, the kernel will dispatch the request to the application. The client will wait for the server answer until a timeout will occur (timeout that is configured in the application).
If the connection is refused you need to check the logs to find out why.
If it works 99% of the time, then it's not a firewall issue. Postfix should be able to handle most loads without dying on you...if this is intermittently showing up in the logs, then it seems to be recovering. I'd look at the timestamp on the failed connection and match it to your logs in Postfix and see what happens around that time.