XON and XOFF

- - posted in bash, emacs, signals, ssh, vi, vim

It started with SSH sessions to the Bangalore data center freezeing up sporadically.

It wasn’t all that sporadic, a pattern was noticed soon enough – a harmless C-x C-s issued when inside vi.

Unfortunately, most distros do not come bundled with emacs and I have to resort to botching up and fumbling with vi (or vim) to edit a few configurations now and then. Everytime I’d tweak an LXC configuration with vim and hit C-x C-s on the unsuspecting editor, things would freeze up. It’d refuse to respond to even the widely respected un-interceptability of the ^Z. Since I use a multiplexed SSH control-master, I’d waste no time opening another SSH to the obstinate host in a different tab and mind my business.

Till I learned about flow control.

What is software flow control?

Software Flow Control enables communication links to be started or stopped using the primary communication channel, which in this case was the ssh tunnel. XON and XOFF dictate the status of the data-link transmission to the tty (X stands for transmission).

XOFF is mapped to C-s by default, which causes the SSH session to not receive any signals.

It can be promptly remedied by an XON (mapped to C-q by default) to resume the transmission.

Emacs by default intercepts all C- sequences and hence does not exhibit this behaviour.

TL;DR SSH freezes up, ‘hangs’ or stops responding when you hit C-s? Use C-q to resume it.

Comments