Skip to content

Commit

Permalink
Set default socket timeout for all socket oprations.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
p2004a committed Nov 26, 2023
1 parent e04d1be commit 4a85414
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/map_syncer/map_syncer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import queue
import shutil
import signal
import socket
import sys
import threading
import time
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 4a85414

Please sign in to comment.