From 4194c5e5ff388cbf975c16d0e4455b53ad4c317f Mon Sep 17 00:00:00 2001 From: Marek Rusinowski Date: Sun, 26 Nov 2023 18:59:27 +0100 Subject: [PATCH] Set default socket timeout for all socket oprations. On one of the servers, syncing was stuck for a few hours and after attaching to debugger, it was waiting for something on some TLS connection. Let's make sure that all socket operations time out after some reasonable timeout. --- tools/map_syncer/map_syncer.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/map_syncer/map_syncer.py b/tools/map_syncer/map_syncer.py index a7a20f4..0842179 100755 --- a/tools/map_syncer/map_syncer.py +++ b/tools/map_syncer/map_syncer.py @@ -17,6 +17,7 @@ import queue import shutil import signal +import socket import sys import threading import time @@ -48,6 +49,10 @@ DEFAULT_DELETE_AFTER = 4 * 60 * 60 # 4 hours DEFAULT_POLL_INTERVAL = 10 * 60 # 10 minutes +# In some rare instances, sockets can get stuck. Let's make sure that +# we timeout them after some time for all socket oprations. +socket.setdefaulttimeout(60) + @dataclass class LiveMapEntry: