Connection timed out for all my e-mail accounts after migration to a new server


#1

Hey,

I migrated my Mailpile installation with all its content and settings to a new server yesterday. The new server is made from a snapshot of the old one, so everything is identical. I updated the DNS settings so that my mailpile.domain.tld is reachable on the new server, and it works: I can see the Mailpile page, log in and all my e-mails are there. However, all e-mail accounts fail to synchronize. I get the following errors: “Connection timed out - edit settings”. The settings are right though, they worked on the previous server and nothing has changed. I have tried re-entering the password for one of the accounts, but the issue persists. Did I miss something?

Thanks in advance for your help.

Kabouik


#2

Is there a firewall at the other end, blocking the connections?

Is Mailpile trying to use Tor, and Tor not working?


#3

Thanks @BjarniRunar. There was no firewall and Mailpile was not set to use Tor.

However, everything seems to be back to normal after a git pull (and, more precisely, a git checkout 0ea3a34270af72714620035fb1c6ba096cf5db7f because I have problems with GnuPG 1.14.18 and the latest version of Mailpile, and would have to pass some extra parameters to run Mailpile). I am not sure exactly which file updated through pull has helped, since my older version of Mailpile did work correctly on the previous server, but I guess something was locking my accounts and has been reset.


#4

It turns out the issue is not solved, all my e-mail accounts in Mailpile eventually fail to connect to either smtp or imap after a few hours of use of Mailpile. The mailpile.service is still running with no errors on my server, but only stopping it and restarting it will temporarily solve the “connection timed out” issue again when importing new mail or attempting to empty the outbox. I guess this is why I initially thought the git pull solved the issue.

I have plenty of RAM on the server (8 GB, more than 66% free) and no CPU overload, so I am not sure why Mailpile eventually fails to connect to my accounts. The Mailpile GUI itself is still responsive and it is still possible to search or read e-mails already imported. Of note, restarting mailpile.service takes more than 10 minutes (regardless of whether I quit Mailpile in a clean way before, using quit in the builtin terminal), which sounds unusual and probably suggests a failure to stop it correctly.


#5

I started from scratch by doing a new installation of Mailpile using the apt stable package, added three accounts (including one that sends emails using SMTP from a 4th e-mail account; works fine), imported messages and tested sending messages: everything was working as expected. Unfortunately, this morning, I noticed that the “connection timed out” issue is back.

In the “Network” page in the Mailpile GUI, it seems that there were no attempts to connect to my accounts after 4:57 AM CET, and the last entry at 4:57 AM was a successful connection. Nothing after that. Yet, the mailpile.service is still running and active on my server. It has been started yesterday at 23:40 CET, meaning it managed to import messages for about 5 hours before suddenly stopping and throwing the “connection timed out” error. No errors in sudo systemctl status mailpile.

Obviously the error is on my end but I fail to understand what can be wrong. This is a new installation, and the accounts are from different e-mail providers so I doubt the server IP would get banned from all of them at the same time. Plus restarting the service wouldn’t solve the issue temporarily if that was the case.


#6

Maybe it could be useful to take a look at the Mailpile logs.
I am using directly Mailpile after downloading from github, but probably the logs are encrypted too for you.
I have found that it is possible to extract them by navigating from the Mailpile console to the logs directory

cd ~

cd .local/share/Mailpile/default/logs

you can confirm the path by looking in another terminal session that’s far easier

then you have several files with inspiring names such as 5ca4fece-0001f-5e41, you can select the more interesting file by looking at the files from a standard terminal session where you can get their creation dates, then from the Mailpile console, you can

cat 5ca4fece-0001f-5e41 >/home/myusername/log1.txt

you can open the freshly created file (log1.txt in my example) with a standard editor (gedit for example) since it will be unencrypted.
It does not bring anything new but it’s far easier to read than in the Mailpile screens, so you have a better chance to spot something strange that could happen some time before the connection loss.

If you find nothing compromising for you in the file, you can even post it somewhere and share a link.

HTH


#7

Thank you for the suggestion @IKnowNothing. I did something similar following @BjarniRunar’s advice on IRC:

  • SSH into my server
  • Start a screen session
  • Start Mailpile into it
  • set sys.debug = log
  • eventlog/watch

This way I am not using the mailpile.service I created, since it is not the recommended version and might cause unexpected issues. However, I still get the timing out problem after several hours. Here is what the end of the eventlog looks like:

bg/log(20): http://127.0.0.1:33411 "GET /api/0/logs/events/?since=1554421558.828371&gather=1&wait=30&context=search:1e9ad1abf8aceddbe069ee58595237f3 HTTP/1.0" 200 710
http/log(20): Elapsed: 30.011s (Sending response)
http/log(20): Elapsed: 0.001s (output: Set output mode to: json)
http/log(20): Elapsed: 0.001s (output: Set output mode to: sidebar.jhtml!minimal)
bg/log(20): http://127.0.0.1:33411 "GET /api/0/cached/sidebar.jhtml!minimal?id=-tags--404363d14ff439eeb1a5f9333d4a8c9f&context=search:1e9ad1abf8aceddbe069ee58595237f3 HTTP/1.0" 200 14548
http/log(20): Elapsed: 0.008s (Sending response)
http/log(20): Elapsed: 30.002s (eventlog: Found 0 events)
bg/log(20): http://127.0.0.1:33411 "GET /api/0/logs/events/?since=1554421588.898897&gather=1&wait=30&context=search:1e9ad1abf8aceddbe069ee58595237f3 HTTP/1.0" 200 710
http/log(20): Elapsed: 30.012s (Sending response)
http/log(20): Elapsed: 0.001s (output: Set output mode to: json)
5ca367d2-0015d-292d=ImapMailSource:R Connected to IMAP server disroot.org
5ca367d2-0015d-292d=ImapMailSource:R Checking for new mailboxes
5ca367d2-0015d-292d=ImapMailSource:R No new mail at 01:47
5ca367d2-0015d-292d=ImapMailSource:R No new mail at 01:47
http/log(20): Elapsed: 9.779s (eventlog: Found 1 events)
bg/log(20): http://127.0.0.1:33411 "GET /api/0/logs/events/?since=1554421618.953974&gather=1&wait=30&context=search:1e9ad1abf8aceddbe069ee58595237f3 HTTP/1.0" 200 3011
http/log(20): Elapsed: 9.789s (Sending response)
http/log(20): Elapsed: 0.001s (output: Set output mode to: json)
http/log(20): Elapsed: 0.001s (output: Set output mode to: sidebar.jhtml!minimal)
bg/log(20): http://127.0.0.1:33411 "GET /api/0/cached/sidebar.jhtml!minimal?id=-tags--404363d14ff439eeb1a5f9333d4a8c9f&context=search:1e9ad1abf8aceddbe069ee58595237f3 HTTP/1.0" 200 14548
http/log(20): Elapsed: 0.008s (Sending response)
5ca36849-00414-292d=ImapMailSource:R Connected to IMAP server disroot.org
5ca36849-00414-292d=ImapMailSource:R Checking for new mailboxes
5ca36849-00414-292d=ImapMailSource:R No new mail at 01:47
5ca36849-00414-292d=ImapMailSource:R No new mail at 01:47
http/log(20): Elapsed: 23.601s (eventlog: Found 1 events)
bg/log(20): http://127.0.0.1:33411 "GET /api/0/logs/events/?since=1554421628.210383&gather=1&wait=30&context=search:1e9ad1abf8aceddbe069ee58595237f3 HTTP/1.0" 200 2851
http/log(20): Elapsed: 23.610s (Sending response)
http/log(20): Elapsed: 0.001s (output: Set output mode to: json)
packet_write_wait: Connection to {==PUBLIC IP OF MY SERVER==} port 22: Broken pipe

Not sure what caused the broken pipe at the end.


#8

That all looks normal. Is it reporting connection timed out in the UI at the same time?

Since it appears your SSH session got disconnected (that last line is not from Mailpile), you should be able to reconnect by opening a new ssh session and running screen -r.


#9

The issue does not seem to be synchronized with the broken ssh session: yesterday I put my computer to sleep at around 6 pm and Mailpile kept synchronizing emails until 9 pm. However I can confirm that the issue eventually occurred again.

This morning, I have reattached the screen process with screen -r, Mailpile is still running. I have a message in my outbox, so I tried sendmail in the Mailpile terminal: it tries to send the message but will never succeed, and all inbox folders fail to import new messages as well:

...
http/log(20): Elapsed: 3.081s (Sending response)
http/log(20): Elapsed: 0.001s (output: Set output mode to: json)
5ca367d2-0015d-292d=ImapMailSource:R Connection timed out
5ca367d2-0015d-292d=ImapMailSource:R Connection timed out
http/log(20): Elapsed: 1.003s (eventlog: Found 1 events)
bg/log(20): http://127.0.0.1:33411 "GET /api/0/logs/events/?since=1554794894.900855&gather=1&wait=30&context=search:6b14d6dc114f4a4fe1b5f5775e2a9adc HTTP/1.0" 200 2967
http/log(20): Elapsed: 1.013s (Sending response)
http/log(20): Elapsed: 0.001s (output: Set output mode to: json)
http/log(20): Elapsed: 0.001s (output: Set output mode to: sidebar.jhtml!minimal)
bg/log(20): http://127.0.0.1:33411 "GET /api/0/cached/sidebar.jhtml!minimal?id=-tags--404363d14ff439eeb1a5f9333d4a8c9f&context=search:6b14d6dc114f4a4fe1b5f5775e2a9adc HTTP/1.0" 200 14555
http/log(20): Elapsed: 0.008s (Sending response)
http/log(20): Elapsed: 30.002s (eventlog: Found 0 events)
bg/log(20): http://127.0.0.1:33411 "GET /api/0/logs/events/?since=1554794897.415822&gather=1&wait=30&context=search:6b14d6dc114f4a4fe1b5f5775e2a9adc HTTP/1.0" 200 709
http/log(20): Elapsed: 30.011s (Sending response)
http/log(20): Elapsed: 0.001s (output: Set output mode to: json)
http/log(20): Elapsed: 0.001s (output: Set output mode to: sidebar.jhtml!minimal)
bg/log(20): http://127.0.0.1:33411 "GET /api/0/cached/sidebar.jhtml!minimal?id=-tags--404363d14ff439eeb1a5f9333d4a8c9f&context=search:6b14d6dc114f4a4fe1b5f5775e2a9adc HTTP/1.0" 200 14555
http/log(20): Elapsed: 0.009s (Sending response)
http/log(20): Elapsed: 30.002s (eventlog: Found 0 events)
bg/log(20): http://127.0.0.1:33411 "GET /api/0/logs/events/?since=1554794928.452827&gather=1&wait=30&context=search:6b14d6dc114f4a4fe1b5f5775e2a9adc HTTP/1.0" 200 709
http/log(20): Elapsed: 30.011s (Sending response)
http/log(20): Elapsed: 0.001s (output: Set output mode to: json)
http/log(20): Elapsed: 0.001s (output: Set output mode to: sidebar.jhtml!minimal)
bg/log(20): http://127.0.0.1:33411 "GET /api/0/cached/sidebar.jhtml!minimal?id=-tags--404363d14ff439eeb1a5f9333d4a8c9f&context=search:6b14d6dc114f4a4fe1b5f5775e2a9adc HTTP/1.0" 200 14555
http/log(20): Elapsed: 0.008s (Sending response)
http/log(20): Elapsed: 30.002s (eventlog: Found 0 events)
bg/log(20): http://127.0.0.1:33411 "GET /api/0/logs/events/?since=1554794958.763543&gather=1&wait=30&context=search:6b14d6dc114f4a4fe1b5f5775e2a9adc HTTP/1.0" 200 709
http/log(20): Elapsed: 30.011s (Sending response)
http/log(20): Elapsed: 0.001s (output: Set output mode to: json)
5cac48ca-0173d-ae3=Sendit:i Could not send mail to [redacted]@[redacted].fr
Could not send mail to [redacted]@[redacted].fr
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mailpile/plugins/compose.py", line 927, in command
    events=events)])
  File "/usr/lib/python2.7/dist-packages/mailpile/smtp_client.py", line 358, in SendMail
    RunTimed(300, sm_startup, unique_thread='smtp-client')
  File "/usr/lib/python2.7/dist-packages/mailpile/util.py", line 1139, in RunTimed
    RunTimedThread(func.__name__, work, unique=unique).run_timed(timeout)
  File "/usr/lib/python2.7/dist-packages/mailpile/util.py", line 1120, in run_timed
    raise TimedOut('Timed out: %s' % self.name)
TimedOut: Timed out: sm_startup

sendmail error: Nothing was sent
5cac48ca-0173c-ae3=EmptyOutbox:c sendmail: Nothing was sent
Elapsed: 300.031s (sendmail: Nothing was sent)

No results

Only quitting Mailpile and starting it again makes it successfully connect to my accounts again (and the message in Outbox is still here, which shows “offline” stuff is saved). However, quitting Mailpile shows this and hangs on the last line:

mailpile> quit
5ca367d2-0015d-292d=ImapMailSource:R Connection timed out
5ca367d2-0015d-292d=ImapMailSource:R Connection timed out
5ca36ddb-01fcf-292d=ImapMailSource:R Connection timed out
5ca36ddb-01fcf-292d=ImapMailSource:R Connection timed out
http/log(20): Elapsed: 12.885s (eventlog: Found 2 events)
bg/log(20): http://127.0.0.1:33411 "GET /api/0/logs/events/?since=1554795194.710731&gather=1&wait=30&context=search:4ec1233cf777016abd1634243df3133f HTTP/1.0" 200 5009
http/log(20): Elapsed: 12.895s (Sending response)
http/log(20): Elapsed: 0.000s (output: Set output mode to: json)
5cac4ac9-017c4-ae3=Quit:c quit: quit
Elapsed: 0.610s (quit: quit)
5caaf65b-00002-ae3=InteractCommand:c interact: 
Elapsed: 0.000s (interact: )
Waiting for <ImapMailSource(inra via yandex, started 140474277414656)>: Waiting... (disco)
5ca36849-00414-292d=ImapMailSource:R Shutdown
5ca36849-00414-292d=ImapMailSource:R Shutdown
5ca367d2-0015d-292d=ImapMailSource:R Shutdown
5ca367d2-0015d-292d=ImapMailSource:R Shutdown
5ca36ddb-01fcf-292d=ImapMailSource:R Shutdown
5ca36ddb-01fcf-292d=ImapMailSource:R Shutdown
Waiting for <HttpWorker(Thread-5, started daemon 140474622932736)>
Waiting for <Worker(Slow worker, started 140473884735232)>: Rescan (44670s, jobs=2, jobs_after=0)
http/log(20): Elapsed: 1.003s (eventlog: Found 5 events)
bg/log(20): http://127.0.0.1:33411 "GET /api/0/logs/events/?since=1554795207.897429&gather=1&wait=30&context=search:4ec1233cf777016abd1634243df3133f HTTP/1.0" 200 8635
http/log(20): Elapsed: 1.015s (Sending response)

It seems I have to kill the process and cannot quit gracefully.


#10

Note that, sometimes, I can quit Mailpile in a clean way:

...
 5ca36849-00414-292d=ImapMailSource:R Shutdown
 5ca36ddb-01fcf-292d=ImapMailSource:R Shutdown
 5cab9c4b-01610-ae3=Rescan:R rescan: Starting
 5cac508a-00193-73ca=KeyTofu:R crypto/keytofu: Starting

Live sessions:
  KKGcwFRaRh29U9tbxJ3aPhULfjQ6wVV3/{'t': '5cac4baf'} = DEFAULT (6s)

Postinglist timers:
{'load': 6.356545686721802, 'load_count': 234, 'save': 0.0039479732513427734, 'save_count': 6, 'render': 0.053855180740356445}

Threads: (bg delay 0.000s, live=0, httpd=0)
  <_MainThread(MainThread, started 139957332018944)>

Locks:
  config._lock is unlocked
  config.index._lock is unlocked
  config.index._save_lock is unlocked
  config.vcards._lock is unlocked
  mailpile.plugins.compose.GLOBAL_EDITING_LOCK is unlocked
  mailpile.plugins.contacts.GLOBAL_VCARD_LOCK is unlocked
  mailpile.postinglist.GLOBAL_GPL_LOCK is unlocked
  mailpile.postinglist.GLOBAL_OPTIMIZE_LOCK is unlocked
  mailpile.postinglist.GLOBAL_POSTING_LOCK is unlocked
  mailpile.postinglist.PLC_CACHE_LOCK is unlocked

But I don’t know what was different. Sorry I couldn’t paste all the lines that showed up when I typed quit, but it seems I cannot scroll up in the logs.


#11

Looking at mailpile code, something looks fishy to me in smtp_client.py
around line 256, you should find something like

                try:
                    with ConnBroker.context(need=conn_needs) as ctx:
                        server.connect(host, int(port))
                    server.sock.settimeout(120)

could you try to move the line server.sock.settimeout(120) before the line ‘with ConnBroker …’ and restart mailpile ?
beware of pythons, they are wearing white spaces, do not break alignment of statements ! do a save of the original file mv smtp_client.py smtp_client.py.ori and cp smtp_client.py.ori smtp_client.py if you don’t feel at ease with editing source files.


#12

Thanks for your answer @IKnowNothing. However, as mentioned in a post earlier, I am now using the packaged version of Mailpile using the Debian repository, so I am not sure how this could be wrong just on my installation (?). I was using Mailpile from source before, but I did not have the issue.

The issue seems to have appeared since I moved to a new server because I noticed it before reinstalling Mailpile from the repository, but it’s still the same server provider as before and there is no stability issue in my server statistics. And Mailpile is still readable/browsable, it just stops attempting to connect to my e-mail accounts according to Mailpile-settings/Network, and reports that the connection timed out without really trying.


#13

me neither, but according to you there is definitely something going wrong. My idea was just a hunch that there could be something going bad in Mailpile if some mail server was getting not accessible for more than 5 minutes. Normally that’s something a mail client should be able to recover from, but Mailpile is not on a stable version yet. So I found this code that looks unusual for socket programming (normally you set the timeout before attempting to connect, not after). and I had the idea to make it more what I am accustomed to.
Well, if you don’t want to try it I’m not going to force you :slight_smile:


#14

Oh no, don’t get me wrong @IKnowNothing, that is not what I meant, I will definitely try if I can and I meant it when I thanked you. :] I’m just not sure how to proceed since I am running the packaged version. Can I edit smtp_client.py without running Mailpile from source? I didn’t think I could and that is why I thought there was a confusion, but I will have a look as soon as possible.

I should edit so that it looks like this, right?

                try:
                    server.sock.settimeout(120)
                    with ConnBroker.context(need=conn_needs) as ctx:
                        server.connect(host, int(port))

Where is this file located? I have something in /opt/mailpile but that is my old installation of Mailpile from sources.


#15

Technically you can certainly change a python source code and after the app is restarted (in this case the service) it will be picked up and run directly like any other file, it’s an interpreted language.
There is no watchdog to bite you if you do an unauthorized change and the mailpile creator will not sue you I think. Now if you do a syntax error in editing the file, the app will fail to restart (here the alignment problem can hit hard, that’s why it’s good to save the file before and change a copy)

I hasten to say that from a sanitary point of view, hacking away at files installed with a package manager is generally NOT a good idea. But usually you don’t get apps that are not yet in a stable version installed with a package manager, so I’d say it’s a special case.

I have never installed mailpile with apt (I test it using a git-cloned directory) but you can find installed files like any apt installed packages with apt-file

apt-file list <package name>

if you don’t have apt-file installed, sudo apt install apt-file
then grep on smtp_client and you will find your target. Good luck. And save the file before editing.


#16

Thanks. Warnings understood, no worries. :]

I installed apt-file, ran apt-file update, but unfortunately apt-file list mailpile doesn’t return anything (no errors either). If I run it with the verbose argument, I just get the following but I don’t think it helps:

D: Using cache directory /var/cache/apt/apt-file
D: reading sources file /etc/apt/sources.list
D: got 'deb http://ftp.fr.debian.org/debian/ jessie main contrib non-free'
D: kept 'deb http://ftp.fr.debian.org/debian/ jessie main contrib non-free'
D: got 'deb http://security.debian.org/ jessie/updates main contrib non-free'
D: kept 'deb http://security.debian.org/ jessie/updates main contrib non-free'
D: got 'deb http://ftp.debian.org/debian/ jessie-backports main contrib non-free'
D: kept 'deb http://ftp.debian.org/debian/ jessie-backports main contrib non-free'
D: got 'deb http://ftp.fr.debian.org/debian/ jessie-backports main contrib'
D: kept 'deb http://ftp.fr.debian.org/debian/ jessie-backports main contrib'
D: got 'deb http://nginx.org/packages/mainline/debian/ jessie nginx'
D: kept 'deb http://nginx.org/packages/mainline/debian/ jessie nginx'
D: got 'deb http://packages.dotdeb.org jessie all'
D: kept 'deb http://packages.dotdeb.org jessie all'
D: got 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main'
D: kept 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main'
D: reading sources file /etc/apt/sources.list.d//000-mailpile.list
D: got 'deb https://packages.mailpile.is/deb release main'
D: kept 'deb https://packages.mailpile.is/deb release main'
D: reading sources file /etc/apt/sources.list.d//alessandro-strada-ppa-jessie.list
D: reading sources file /etc/apt/sources.list.d//ee-repo.list
D: got 'deb http://download.opensuse.org/repositories/home:/rtCamp:/EasyEngine/Debian_8.0/ /'
D: kept 'deb http://download.opensuse.org/repositories/home:/rtCamp:/EasyEngine/Debian_8.0/ /'
D: reading sources file /etc/apt/sources.list.d//nodesource.list
D: got 'deb https://deb.nodesource.com/node_6.x jessie main'
D: kept 'deb https://deb.nodesource.com/node_6.x jessie main'
D: reading sources file /etc/apt/sources.list.d//syncthing.list
D: got 'deb http://apt.syncthing.net/ syncthing release'
D: kept 'deb http://apt.syncthing.net/ syncthing release'
D: regexp: ^\s*(.*?)\s+(\S*/\S*mailpile\S*)\s*$
D: Search in \/var\/cache\/apt\/apt\-file\/ftp\.fr\.debian\.org_debian_dists_jessie_main_Contents\-amd64\.gz using zfgrep  -- mailpile

D: Search in \/var\/cache\/apt\/apt\-file\/ftp\.fr\.debian\.org_debian_dists_jessie_contrib_Contents\-amd64\.gz using zfgrep  -- mailpile

D: Search in \/var\/cache\/apt\/apt\-file\/ftp\.fr\.debian\.org_debian_dists_jessie_non\-free_Contents\-amd64\.gz using zfgrep  -- mailpile

D: Search in \/var\/cache\/apt\/apt\-file\/security\.debian\.org_dists_jessie_updates_main_Contents\-amd64\.gz using zfgrep  -- mailpile

D: Search in \/var\/cache\/apt\/apt\-file\/security\.debian\.org_dists_jessie_updates_contrib_Contents\-amd64\.gz using zfgrep  -- mailpile

D: Search in \/var\/cache\/apt\/apt\-file\/security\.debian\.org_dists_jessie_updates_non\-free_Contents\-amd64\.gz using zfgrep  -- mailpile

Maybe @BjarniRunar can tell where is the default installation folder for Mailpile in Debian?


#17

oh bummer I have always used apt-file to great success and I had never realized that it needed the package maintainer to generate a special file to work.
Installed the thing in a container, it’s in
/usr/lib/python2.7/dist-packages/mailpile


#18

Guys, the timeout cannot be set before the connect call, because the socket doesn’t even exist at that point. You’re barking up the wrong tree, here.

If you want to know where a deb package puts its files, just: dpkg -L package


#19

well, you may be right in the context of your app, I have not looked deep enough for that.
In a general way however

root@q1900B:/tmp# cat escnx.py 
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('www.microsoft.com', 81))

root@q1900B:/tmp# cat escnxtimeout.py 
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(3)
sock.connect(('www.microsoft.com', 81))

root@q1900B:/tmp# time python escnxtimeout.py 
Traceback (most recent call last):
  File "escnxtimeout.py", line 4, in <module>
    sock.connect(('www.microsoft.com', 81))
  File "/usr/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.timeout: timed out

real	0m3,369s
user	0m0,045s
sys	0m0,004s

root@q1900B:/tmp# time python escnx.py 
^CTraceback (most recent call last):
  File "escnx.py", line 3, in <module>
    sock.connect(('www.microsoft.com', 81))
  File "/usr/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
KeyboardInterrupt

real	0m13,352s
user	0m0,034s
sys	0m0,005s

#20

For what it’s worth, while I have been having this issue regularly since I opened this thread, it didn’t occur in the last 4 or 5 days. The only thing I did is sudo apt-get upgrade on my server, but it was already being updated regularly before that. I am not sure which package update may have fixed the issue more recently. I’ll report back if the issue appears again.