Developer Connectivity

SSH Drops, Database Timeouts & Flaky VPNs While Working Abroad

Samad Mokrini Updated July 20, 2026 10 min read Worldwide
Developer's terminal window showing an SSH session and database connection logs on a laptop screen
Quick answer:

SSH connections die on unstable WiFi because TCP itself has no idea the network changed — it just waits, and most client/server keep-alive settings are too permissive to notice a dead connection before you do. Database timeouts abroad are usually a latency problem, not a bandwidth one: a connection pool or query timeout tuned for same-region latency (a few ms) starts failing when you're actually 150-250ms away from the server. Git push/pull failures on flaky connections are almost always HTTP-transport related and fixable by switching to SSH transport with retry logic, or resuming a large push in chunks. None of this is "just get better WiFi" — it's configuration that assumed a stable, low-latency network and needs to assume the opposite instead.

What this guide covers

SSH Dying Mid-Command: Keep-Alive Settings and Mosh

Plain SSH has no built-in awareness that your WiFi hiccuped — TCP will happily sit in a half-open state waiting for a response that's never coming, which is why a session can look "frozen" for a full TCP timeout window (often 15-20 minutes with default settings) before your client finally gives up. The fix most people skip is ClientAliveInterval and ClientAliveCountMax on the server side, and ServerAliveInterval in your client's ~/.ssh/config — setting these to something like 15-30 seconds means a dead connection gets detected and dropped in under a minute instead of hanging indefinitely, which at least lets you reconnect immediately instead of staring at a frozen terminal.

For genuinely unstable connections — train WiFi, spotty rural cell coverage, congested coworking WiFi — Mosh (mobile shell) is the better tool, not a workaround. It runs over UDP with a local echo and a custom state-sync protocol instead of TCP, so it survives IP changes, sleep/wake cycles, and dropped packets without killing the session — you'll see it visibly "catch up" instead of disconnect. The tradeoff is it needs a UDP port range open on the server, which is a one-time setup we can configure remotely alongside your SSH keep-alive settings.

Database Connection Timeouts: It's Latency, Not Bandwidth

A database timeout after switching countries is rarely about your connection being too slow in the bandwidth sense — it's latency. A connection pool or query timeout configured for a server in the same region (typically 1-5ms round trip) doesn't magically fail at 50ms, but once you're routing traffic from, say, Southeast Asia to a database in US-East, you're looking at 200ms+ round trip on every single query, and connection pool settings that assume near-instant acquisition start timing out on pool checkout, not just on slow queries.

The practical fixes we handle remotely: raising connectionTimeoutMillis / statement_timeout (Postgres) or connectTimeout / wait_timeout (MySQL) to realistic values for your actual current latency rather than the values your team set when everyone was in one office, checking whether your ORM's connection pool size is starving under higher latency (fewer connections completing per second means more queued requests hitting the pool timeout), and confirming your database driver is using persistent/pooled connections rather than opening a fresh TCP+TLS handshake per query, which turns a 5ms local overhead into a 400-600ms overhead at distance.

Git Push/Pull Failures on Flaky Hotel or Cafe WiFi

Git over HTTPS is more fragile on unstable connections than most people realize — a large push over HTTP can fail partway through and, depending on your git version and the remote's configuration, sometimes leaves you with a corrupted pack or a push that "succeeded" on your end but never fully landed. Switching the remote to SSH transport (git remote set-url origin git@host:... instead of https://host/...) gives you a persistent, resumable connection that tolerates brief drops better, especially combined with git config http.postBuffer increases if you're staying on HTTPS for auth reasons.

For genuinely large pushes on bad connections, git config --global http.lowSpeedLimit and http.lowSpeedTime control when git gives up on a stalling transfer — the defaults are often too aggressive for satellite or heavily congested WiFi and abandon a push that would have completed if given another 30 seconds. We can also set up a lightweight bounce server or use git bundle for genuinely offline-first workflows when you're somewhere with no reliable connection at all.

VPN Tunnel Instability Breaking Everything Downstream

A VPN tunnel adds its own failure mode on top of the underlying connection instability — most consumer and even some corporate VPN clients don't handle a dropped WiFi handshake or an IP change (switching from WiFi to hotspot mid-session, common when working from moving transport) gracefully, and the tunnel can end up in a state where it thinks it's connected but nothing is actually routing, which is worse than being disconnected because everything just hangs instead of failing fast.

WireGuard-based VPNs handle this materially better than OpenVPN because of how the protocol re-establishes state, and it's worth checking whether your corporate VPN client supports it before assuming your only option is the default OpenVPN config IT handed you. If your dev workflow depends on VPN access to internal infrastructure, see our VPN setup guide for remote workers for the connection-stability side of this — combined with the keep-alive and timeout tuning above, this covers most "everything just hangs" scenarios.

Choosing Infrastructure Closer to Where You Actually Are

The highest-leverage fix, and the one most teams never consider until someone's actually abroad, is not tuning timeouts at all — it's putting a read replica, a caching layer, or a bastion/jump host in the region you're actually working from. A jump host in the same region as you, tunneling to the origin infrastructure over a connection that infrastructure providers optimize (rather than consumer hotel WiFi doing the long haul), turns a 250ms round trip into two shorter, more reliable hops instead of one long fragile one.

This is more setup than a keep-alive tweak, but for developers doing extended stays (months, not days) in one region, it's worth the one-time cost — we can help configure a bastion host or regional read replica as part of a session if your current infra doesn't have one, which also pairs well with a properly configured remote desktop setup if part of your workflow depends on a machine physically closer to your infrastructure.

Get Your Dev Workflow Working Again

"Just restart your router" isn't a real fix for a keep-alive misconfiguration or a timeout value tuned for the wrong region — this needs someone who actually reads the SSH config and the connection pool settings, not generic troubleshooting.

SSH dying mid-deploy or your DB pool timing out on every other query?

We'll configure keep-alive, mosh, connection pooling, and VPN settings so bad WiFi stops breaking your workflow.

Book a remote fix — $149.99

Frequently asked questions

Why does my SSH session freeze instead of just disconnecting?

TCP doesn't detect a dead connection on its own — it waits for a timeout that can be 15-20 minutes by default. Setting ServerAliveInterval in your SSH config (client side) and ClientAliveInterval on the server detects the drop in under a minute so you can reconnect instead of waiting it out.

What's the actual difference between SSH and mosh for unstable connections?

SSH runs over TCP, which handles IP changes and packet loss poorly. Mosh runs over UDP with local echo and state-sync, so it survives WiFi-to-hotspot switches, sleep/wake, and dropped packets without killing the session — you'll see it catch up rather than disconnect.

Why do my database queries start timing out only when I'm traveling?

It's latency, not bandwidth — a connection pool or query timeout tuned for same-region round trips (a few ms) starts failing once you're 150-250ms from the server. We adjust statement_timeout/connectTimeout and pool sizing to realistic values for your actual distance from the database.

Should I switch git from HTTPS to SSH for a more stable connection?

Yes, generally — SSH transport tolerates brief drops better than HTTPS pushes, which can fail partway through on a large transfer. If you need to stay on HTTPS, increasing http.postBuffer and adjusting lowSpeedLimit/lowSpeedTime helps stalling transfers survive.

My corporate VPN hangs instead of disconnecting when my WiFi drops — is that normal?

It's common with OpenVPN-based clients, which handle IP changes poorly and can leave the tunnel in a state where it thinks it's connected but isn't routing traffic. WireGuard-based VPNs handle this better — see our VPN setup guide if you can switch.

Is moving my infrastructure closer to where I'm working actually worth it?

For a short trip, no — timeout tuning is enough. For an extended stay (months) in one region, a regional bastion host or read replica turns one long fragile connection into two shorter, more reliable ones, and it's a one-time setup we can help configure.

SM

Samad Mokrini

Founder of IT Cares Canada (est. 2014) and RemoteFix 24/7. Two decades fixing computers for people who can't get to a shop — now for remote workers, expats, and nomads in 130+ cities worldwide.