ssh hangs with high latency connection (connecting internationally) - ssh

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.

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).

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.

Try adjusting your TCP window size.

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.

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.

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!

I was having a similar problem with 'cat' and even 'ls -l' causing ssh to hang (on Ubuntu). Adjusting MTU size to 1400 fixed it for me.

Related

Connecting to tty port through C++ fails unless you've connected through screen first

I picked up an AUPS-A10-R11 DC UPS, and am working with their API to build some monitoring software for my xen host. Their API runs over the USB connection on the device, which presents itself as /dev/ttyUSB# on the host.
I've got things working fine except for one thing that's puzzling me. When I first power on or reboot the host it's connected to, I can't communicate with the device. However, if I open up a screen connection to it:
screen /dev/ttyUSB0 9600
and then close it (ctrl+a, k) then it will work perfectly fine until the next time that you reboot the host.
Does anyone have any idea as to why I would have to connect to the device over screen first? I've pasted my code here: http://susepaste.org/0b8bb37f . When connecting on a fresh reboot, it stops at the "Read Nothing" section of the if...else clause. After connecting to the device with screen, it works fine.
Any thoughts??
Does anyone have any idea as to why I would have to connect to the device over screen first?
Such behavior is almost always related to incomplete termios initialization by your program.
The ideal program would configure a serial terminal for its purposes, and on exit restore the termios configuration back to the way it found it.
But most programs, including terminal emulation programs such as minicom and apparently screen, simply leave their termios configuration instead of restoring it.
Fortunately for you, this leftover termios configuration fills in the missing pieces that allows your program to access the serial terminal as expected.
Review of "your" code suggests that it was copied from the accepted answer of this question. Based on the number of up-votes, this code apparently works for a lot of people. However the author admits it was written before POSIX standards, and therefore the code should not be considered portable. In other words, your mileage may vary.
Apparently you overlooked the alternative answer which is POSIX compliant. A tested termios configuration for blocking non-canonical mode is in that program.
If you prefer to simplify with the use of the cfmakeraw() macro, then here's another code example.

MAMP suddenly stopped working due to a ports and/or server issue Windows

I downloaded MAMP, but when I run it fails on connecting to a port. So the error is about the port 80 (can se the error on the link below). I did what most forums reecomend: set port config to default but it still does not work. Instead inmeadiately after I click accept to make the changes the program suddenly stops running (see the link to the image below).
https://i.stack.imgur.com/lCEex.png
(The last window is in Spanish but it's simple to see it says something went wrong, does not explain what and forces to close the program)
I don't what can it be, I am not an expert on this topic so I feel a bit confused since I've tried almost everything . I'm starting to think it may be a limitation of my pc since it is a bit old, or maybe i'm just missing something.

Raspberry Pi SSH lag slowness

I am experiencing issues with the Pi, when I try to work on the Pi trough SSH I suddenly get lageness. At the beginning it works fine, but intermittently the auto-complete or commands on the history take a long time to load and that affects the typing.
How can I find out what is doing this?
Reading around I found that could be an issue with network, the SD card R/W speeds or even the SSH configuration itself, nothing that I tried of what I found around worked for me which was quite disappointing.
I don't know which the problem was exactly on my case.
I found a solution for me thanks to that several time my SSH session dropped an this is particularly painful If on the middle of running a command, so i decided to look for a way to keep session alive independently I found tmux. Which no only allowed me to keep session alive but it improved my ssh response, I read that mosh would do the same but I decided to go with tmux which work perfectly for me.

Mobile Test Workbench - Status of the RTW server

I've been testing MTWWW for about a couple of days, and I've come to notice something.
I have to add the device to MTWW by going to a url on the device that looks like this,
protocol://hostname:+port/mobile
However, sometimes my device can't reach that address neither when I restart eclipse. When that happens I typically restart my computer and everything is fine and dandy again.
There was even one time that on that same screen that display the QRCode and URL to add a device, a notification appeared which showed something close to "RTW server could not start properly" or something like that.
This led me to believe that MTWW uses some other web server other that WL server to receive the recordings from the instrumented apps.
This also led me to believe that perhaps sometimes when the server tries to start the ports are already binded to some socket and it fails the initialization. Just speculation here.
However if there is a slight sense in what I written, is there a way to inspect the status of the RTW server, some dashboard perhaps?
Besides that, what should I do to fix when the RTW server didn't start properly? Rebooting the computer is pretty lame, there must be something more clever to do.
Oh, I've found this behavior on a mac osx box, on a windows one I haven't done so much testing.
Thanks in advance.
There is no dashboard for the server. But if yoy think that the issue come from the port, you can change it in the preferences. Please read http://www-01.ibm.com/support/docview.wss?uid=swg21678980
Hope its help

SMSC911x network interface cards' light never comes back on after cable replugged

I have this strange problem in an embedded system (linux) we build, so I don't have normal GUI trouble-shooting tools on Linux or Windows machines.
The problem is the NIC is no longer usable after cable removed. Even if I re-plug the cable, the lights on it never come back on again and nothing can be sent or received. ifconfig still works on the surface, but doesn't have real effect. Only a reboot will solve the problem. I guess the problem is in the ethernet driver.
My question is how the trouble-shoot it. Any clues/hints? Thanks.
====================
Thank you guys! The board is a gumstix and the PHY is SMSC911x. We are running on Linux 3.0.12. It turns out the smsc911x_soft_reset() of the NIC fails when driver calls smsc911x_open(). The symptom also includes we must run ifconfig multiple times (not consistent) to bring the NIC up and the system can detect it.
I did a search on "SMSC911x soft reset failed" and find this link. http://comments.gmane.org/gmane.linux.network/216467. I removed SMSC_PHY=y in the linux build config file and that fixed the problem. It seems the driver is not compatible. Can somebody explain this, or is there a better solution?