SSH connections hanging: fixed by disabling TCP window scaling

This is mainly just for my own future reference, but you may end up here via a web search if you ran into the same problem.

I use Symfony2, which leverages Git to manage bundles (a.k.a. libraries). There’s a script called “vendors” which can (currently) be used to update bundles. Running bin/vendors install is a common operation: this descends into every bundle directory and pulls down the latest code. All of my own bundles are reached via git+ssh.

The git+ssh connections to update my bundles were hanging. There are many layers that could be malfunctioning, but I first suspected my failing Netgear wireless access point / router. Lately, weekly reboots have been necessary to even be able to associate with the thing.  I also suspected my /etc/hosts.deny was too big, but these connections were really slow, hanging for minutes at a time (where they were usually instant).

I happened upon this old bug, and decided it might indeed be my router. I ultimately have no idea why, but here’s what fixed the hanging connections for me:

echo 0 | sudo tee /proc/sys/net/ipv4/tcp_window_scaling

I imagine this should be a temporary change, since it sounds like TCP window scaling generally results in more efficient data transfer.

I’m going to round file the netgear tonight, hopefully that’s the problem.

Other ideas: