linux smtp connect very slow

I am running opensuse 13.2 . I am not sure exactly when the problem started. Any smtp connect takes a unusually long time. When I start Thunderbird there is a long wait before the new mail appears.

Also I have a ruby program that sends mail using  the net/smtp and mail gems. It used to work fine. Now using mail defaults it times out on connect start. The default timeout is 30 seconds. If I set it to 200 seconds I get a connection and can send mail. I have not tried to find the minimum timeout necessary. This happens connecting to comcast and gmail.  gmail is 2 factor but comcast is not.

Any suggestions
dml12Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arnoldCommented:
The short duration is only when local, you should set to 60-120.
The connection setup should not take it this long, run traceroute as well as check how much of your bandwidth is being consumed by other things that might explain the issue.

Double check that your outgoing connection is not being proxied.
kaskhedikar_tusharCommented:
First of all, you have to check your email server reverse dns entry with nslookup. Or if you are using email hosting, then ask them.

If you are using hosting server for emails, then check the maximum emails send limits per hour. Increase the limit.

When you send the email from code, please check your email on webmail instead of Thunderbird.

Check the thunderbird settings for receiving email set it to 1 minute.
dml12Author Commented:
A traceroute result is shown below:

sudo traceroute   smtp.comcast.net
traceroute to smtp.comcast.net (96.114.157.81), 30 hops max, 60 byte packets
 1  192.168.50.1 (192.168.50.1)  0.537 ms  0.526 ms  0.519 ms
 2  * * *
 3  te-0-3-0-4-sur01.lascruces.nm.albuq.comcast.net (68.85.224.13)  11.411 ms  12.158 ms  12.171 ms
 4  be-11-ar01.albuquerque.nm.albuq.comcast.net (162.151.97.65)  29.571 ms  18.430 ms  19.513 ms
 5  be-33654-cr01.1601milehigh.co.ibone.comcast.net (68.86.95.237)  27.165 ms  26.134 ms  27.146 ms
 6  be-7922-ar01-d.cmc.co.ndcwest.comcast.net (68.86.94.126)  38.548 ms  32.855 ms  22.776 ms
 7  te-0-1-0-0-ar02-d.potomac.co.ndcwest.comcast.net (68.86.206.2)  23.797 ms  28.176 ms  28.168 ms
 8  te-0-3-0-0-ur08-d.potomac.co.ndcwest.comcast.net (162.151.27.22)  28.412 ms  28.150 ms  28.395 ms
 9  te-0-4-0-1-ur07-d.potomac.co.ndcwest.comcast.net (162.151.27.17)  29.127 ms  29.116 ms  29.118 ms
10  omta-po.sys.comcast.net (96.114.157.81)  25.150 ms  22.735 ms  23.128 ms

I have been using this computer to do email for a long time. The default timeout worked fine for smtp email until a few weeks ago. Also when I started thunderbird it connected almost immediately.

I put an elapsed time check in the ruby code which showed about 127 seconds for smtp.start ,

nslookup smtp.comcast.net              
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
smtp.comcast.net        canonical name = smtp.g.comcast.net.
Name:   smtp.g.comcast.net
Address: 96.114.157.81

I removed the google server and got

nslookup smtp.comcast.net
Server:         192.168.50.1
Address:        192.168.50.1#53

Non-authoritative answer:
smtp.comcast.net        canonical name = smtp.g.comcast.net.
Name:   smtp.g.comcast.net
Address: 96.114.157.81
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

arnoldCommented:
Are you using 25, or 587 or 465 to connect?

Why are your default DNS servers those from Google versus the Comcast ones?

Determining the cause what was going on.
Can you check whether the thunderbird account setup matches the one used within your scripts?
dml12Author Commented:
Both 465 & 587 behaved the same. I preferred the google DNS . The problem was the same with the Comcast DNS.

The problem has magically gone away. The connect time from the Ruby program is now between 500 & 600 milliseconds. Thunderbird now shows mail almost immediately after starting. There is no longer a long delay.  So I have no clue what was wrong. I have not done any updates in the last few days.
arnoldCommented:
Should this occur again, one of the checks you should include, is what your public ip, (whatismyip.com) then lookup the reverse resolution for the ip
Nslookup <wan ip>

Without errors it is hard/impossible to determine.
One other option is to use a terminal app such as putty and initiate a connection to the 587 port and see whether a delay is seen.

I believe it was mentioned that throttling after a large influx might explain it.
I.e. Over a period of a month there is anumerical threshold that your ip exceeds.
See if the issue occurs in the latter part of the month.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dml12Author Commented:
The comments were reasonable but the problem went away on its own.
dml12Author Commented:
Sigh! The problem is Comcast. I connected to my phone as a wifi hotspot and got a reasonable connect ~6 seconds. Why using comcast improved for a few days is still a mystery.

I also did a new clean linux  install on another computer to show that the computer and installation was not the problem. It has the same slow connect with comcast and short connect time with my phone.

I am not sure how to pursue this wwith comcast.
arnoldCommented:
check reverse resolution of your wan ip.
check with their support. presumably other than 25.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.