I looked at the SMTP documentation for a -asynchronous option that would
allow the message to be sent immediately and then allow the main program to
continue without "hanging", but I didn't see anything that appeared related.
Any ideas as to how to get SMTP from hanging?
More info. This is running on RedHat Linux 8.0 and using sendmail. I
discovered that there are default timer values for sendmail and 2 of the
values are for three minutes, which is the time before the above error
message appears.
They are:
lmtp_data_xfer_timeout = 180s
smtp_data_xfer_timeout = 180s
Does anyone have any knowledge with changing these valuse. Since mail
usually works 99% of the time I was thinking that I should lower the values
to 5 seconds, and retry to send if the error occurs. However, I do not want
to wait 3 minutes before retrying again since the program hangs each time it
is trying to send an email. Of course, I also do not know if this is the
problem, but at least the value equals the time.
Also, all the timer values appear to be way to large. Any idea what would
happen if I lowered them to a more reasonable value, such as 5 seconds?
daemon_timeout = 18000s
ipc_timeout = 3600s
lmtp_connect_timeout = 0s
lmtp_data_done_timeout = 600s
lmtp_data_init_timeout = 120s
lmtp_data_xfer_timeout = 180s
lmtp_lhlo_timeout = 300s
lmtp_mail_timeout = 300s
lmtp_quit_timeout = 300s
lmtp_rcpt_timeout = 300s
lmtp_rset_timeout = 300s
qmqpd_timeout = 300s
smtp_connect_timeout = 0s
smtp_data_done_timeout = 600s
smtp_data_init_timeout = 120s
smtp_data_xfer_timeout = 180s
smtp_helo_timeout = 300s
smtp_mail_timeout = 300s
smtp_quit_timeout = 300s
smtp_rcpt_timeout = 300s
smtp_starttls_timeout = 300s
smtp_tls_session_cache_timeout = 3600s
smtpd_timeout = 300s
smtpd_tls_session_cache_timeout = 3600s
trigger_timeout = 10s
This problem is a perfect example of why I love/hate working in the computer
industry. This problem started occuring about 1 month ago in a program that
had been working fine for at least 18 months. All of a sudden I started to
occasionally get these "error reading "sock4": connection timed out"
messages. Most of the time everything worked fine, but then this started
happening. The last few days it has been happening around 50% of the time.
Basically, I was using SMTP/MIME in Tcllib to generate both plain text and
HTML emails. I had configured sendmail to be the Mail Transport Agent and
it appeared to work okay. When I sent an email using my proc SendTclEmail,
the mail log /var/log/maillog would record the transactions. However,
whenever I received the timeout error message nothing was written in
maillog. Nowhere could I find a log file that would give me a clue as to
the problem. It probably exists, but I do not know what I am looking for,
so I probably overlooked it.
Anyway, I suspected that Earthlink, which I was using for my smtp server,
had made some recent change that caused the erratic behavior. That was just
my gut feeling since this part of the program had been working fine for 18
months.
However, I had no clue as to what the problem actually was, how to isolate
it, and fix the problem.
My SendTclEmail code includes this code from SMTP/MIME:
catch {
set token [mime::initialize -canonical text/plain -file $fileName]
smtp::sendmessage $token \
-header [list To $to] \
-header [list From $from] \
-header [list Bcc $bcc] \
-header [list Subject $subject]
mime::finalize $token
} catchResult
catchResult would contain the timeout error message when it occurred.
Out of desperation in looking for a clue, and curious to see what would
happen, I added the -servers option to the above code. Before, it picked up
the SMTP server configured in sendmail.
Now the code looks like this:
catch {
set token [mime::initialize -canonical text/plain -file $fileName]
smtp::sendmessage $token \
-header [list To $to] \
-header [list From $from] \
-header [list Bcc $bcc] \
-header [list Subject $subject] \
-servers $::SMTP_SERVER
mime::finalize $token
} catchResult
Using the -server option results in sendmail being bypassed (my assumption
since nothing is ever written in /var/log/maillog after making the change).
Even more important, I have not had the problem after adding -servers.
I have no idea why this problem started in the first place, and I have no
idea why it seems to work now. But in the off chance that this is a valid
fix I am providing this info so that if someone in the future has a similar
problem then hopefully Google will bring up this thread and it might help
them.
Hope this helps,
John
My first rule of troubleshooting is reboot, reboot, and reboot some more,
but it didn't help.
Telnet to "hostname 25" works fine. I connect every time. I removed
the -servers option from my test script and after sending 22 mails it
"hung". While it was hung I again started telneting and telnet worked
everytime.
To me, it seems as if the problem is at Earthlink's end, not my localhost.
I can receive mail okay, it is the sending mail that fails.