Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SMTP timeout issue

72 views
Skip to first unread message

Tom Conner

unread,
Aug 25, 2006, 6:34:45 PM8/25/06
to
Every once in a while I get this error message from trying to send an email
with Tcllib SMTP: "error reading "sock4": connection timed out". It appears
to be that the SMTP server is not responding, but I cannot swear to that
being the problem. When this happens the main program hangs until the error
message appears.

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?


Tom Conner

unread,
Aug 26, 2006, 2:18:20 PM8/26/06
to

"Tom Conner" <tco...@olopha.net> wrote in message
news:9WKHg.13891$xp2....@newsread1.news.pas.earthlink.net...

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


Tom Conner

unread,
Aug 27, 2006, 12:22:16 AM8/27/06
to

"Tom Conner" <tco...@olopha.net> wrote in message
news:Mf0Ig.1820$bM....@newsread4.news.pas.earthlink.net...

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.


Tom Conner

unread,
Aug 27, 2006, 12:47:22 AM8/27/06
to
One more point is that sendmail works fine. I put it in a loop to generate
emails to the same destination as used by the Tcl SMTP mail code, and it
worked every time. Yet, as soon as I switched over to using the Tcllib
package the problem would start occurring.


John Mercogliano

unread,
Aug 27, 2006, 7:36:20 AM8/27/06
to
Tom,
Try restarting the sendmail service. There might be something wrong
with the process. The reason your test was reacting the way it was is
that when using sendmail as a client it delivers mail directly to the
recipient address, it does not try and send the mail to the local mail
server first. You don't even need a sendmail server running to send
mail using any mail client. So it would not be using the sendmail
daemon that is running to process the messages. TCLLIB with out the
server option sends the mail to the localhost mail server by default.
A more valid test would be to try a simple telnet to the local machines
port 25. In anycase it sounds like there is something wrong with your
local host sendmail server.

Hope this helps,

John

Tom Conner

unread,
Aug 27, 2006, 1:27:54 PM8/27/06
to

"John Mercogliano" <jxme...@sentara.com> wrote in message
news:1156678580.1...@p79g2000cwp.googlegroups.com...

> Tom,
> Try restarting the sendmail service. There might be
> something wrong with the process. The reason your test was
> reacting the way it was is that when using sendmail as a
> client it delivers mail directly to the recipient address,
> it does not try and send the mail to the local mail
> server first. You don't even need a sendmail server running
> to send mail using any mail client. So it would not be using
> the sendmail daemon that is running to process the messages.
> TCLLIB with out the server option sends the mail to the localhost
> mail server by default. A more valid test would be to try a simple
> telnet to the local machines port 25. In anycase it sounds like
> there is something wrong with your local host sendmail server.
>
> Hope this helps,

My first rule of troubleshooting is reboot, reboot, and reboot some more,
but it didn't help.

John Mercogliano

unread,
Aug 28, 2006, 9:38:58 AM8/28/06
to
Tom,
Just curious if you also tried to telnet to your localhost port
25? The fact that tcllib smtp works with the -server option would
indicates that there is something wrong with the localhost smtp server.
Either it's not running, misconfigured, or god forbid someone is mad at
your machine and is mailbombing you. I'm sure there are other reasons
that you might not be able to connect to port 25, but this should be a
starting point.

Tom Conner

unread,
Aug 28, 2006, 11:03:23 AM8/28/06
to

"John Mercogliano" <jxme...@sentara.com> wrote in message
news:1156772338.9...@i3g2000cwc.googlegroups.com...

> Tom,
> Just curious if you also tried to telnet to your
> localhost port 25? The fact that tcllib smtp works with
> the -server option would indicates that there is something
> wrong with the localhost smtp server. Either it's not
> running, misconfigured, or god forbid someone is mad at your
> machine and is mailbombing you. I'm sure there are other reasons
> that you might not be able to connect to port 25, but this should
> be a starting point.
>

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.


0 new messages