views:

790

answers:

6

This is been making my programming really frustrating lately.

I´m in Argentina right now connecting to a U.S. server via SSH. Understandably, the pings are a bit higher here (around 200ms on average) so when I SSH into the server there is a slightly noticeable lag between each keystroke. This is fine and easy enough to work with.

What isn´t easy to work with is that about every 5 minutes or so, SSH will completely hang and take about 3-5 minutes to return back a prompt. I know the server is not bogged down because I can easily open several new connections while I´m waiting for one to return (in fact this is the only way I´ve been able to work). And when SSH finally comes back I can see it has actually been working away in the background (large file downloads was a good way to test this) but it just hasn´t been updating my screen.

Does anyone have an idea what might be causing this?

Few other facts: the server is Ubuntu and I'm connecting with Mac OS X. I have keepalive turned on in the SSH settings. It is most likely to hang when I hold down a key (for example a left or right arrow to scroll) which sends a lot of keys quickly. In fact I can reliably reproduce the hang by logging in and holding down any key like "a" - it never makes it past a full line of "a"'s before hanging. This just started when I connected internationally for the first time so I´m assuming it has something to do with that (latency?) but can´t say for sure.

A: 

Try adjusting your TCP window size.

eduffy
Hi eduffy, I'm reading up on this and tried some things ( http://wheel.troxo.com/2008/06/05/tcp-window-scaling-conundrum/ ), such as disabling tcp window scaling on both the ubuntu server and my mac which I'm using to connect. Hasn't worked so far, but I am admitedly not really sure what I'm doing. If you have any other tips that would be great. Thanks for the reply!
Brian Armstrong
Actually, now I think it may be the Mac terminal. It does that to me quite frequently from my MacBook if I try to receive a lot of data at once (so I try to avoid `cat`).
eduffy
Yeah, I know what you mean a long cat will hang for a few seconds etc. This isn't that though....this is a 5 minute hang after just holding down a single key.
Brian Armstrong
A: 

I'm used to ssh over high latency links - 600ms. It is slow but I rarely had any problems. To start with - open another terminal window, ping your server and watch the connection. Tell us what you see.

Hi Eugene...pings are fine and consistent in a second terminal window. I can even open another connection and continue to work normally (until that one hangs). The server is alive and well during all of this.
Brian Armstrong
A: 

Try sshing in with a few verbose flags (ssh -vv[vv] somehost) and seeing if there's anything indicative printed around the time it hangs.

bdonlan
Hi bdonlan, yep this is a good idea. Unfortunately I tried this last night after reading something similar somewhere. Went up to 3 'v's, and it produced no warnings/errors after returning from the hang.
Brian Armstrong
A: 

Odd. I can't help you with your problem but I have a tip to make it less annoying: Use screen(1). This will keep your shell on the other end alive and you can continue whatever you were doing after reconnecting.

If you only need to run a command on the other side, I suggest to pass the command as an option to ssh (it will connect, run the command, display the result and disconnect).

Aaron Digulla
Good tip, if not a complete solution. Thanks Aaron.
Brian Armstrong
A: 

Well, I am now connected to a different wireless network and the problem seems to have disappeared. I can't say for sure what exactly was causing it (and I don't have login access to the wireless router) but this seems to suggest it was something on the router, and not the server or client computer.

Both the old router and the new router were Linksys WRT54G's so I'm not sure what the problem was. Hope it helps someone!

Brian Armstrong
+1  A: 

I think it was some problem with the ISP down here in argentina. When I switched to another wireless network with another ISP it started working. They are probably playing some port throttling games or who knows what.

Brian Armstrong
welcome to Argentina, land of packet loss.
Mauricio Scheffer