16

Sometimes when my terminal freezes up and it will not let me type. I can not identify any causes, nor how to diagnose. Any suggestions?

Thanks!

GNOME Terminal 2.30.2 on Ubuntu 10.04

3
  • 2
    usually when the terminal freezes it is caused by another application in the background using too many resources, like the CPU or Disk I/O. If you run top in a terminal, you should be able to locate the problem easily.
    – RolandiXor
    Nov 30, 2010 at 2:37
  • @roland - sounds like a catch-22, but good advice since sometimes when one terminal is frozen I can open another and it will work. Nov 30, 2010 at 2:38
  • I Know right? :) It is a bit of a catch-22, but it often works for me.
    – RolandiXor
    Nov 30, 2010 at 2:46

2 Answers 2

37

Did you press Ctrl+S by any chance? It's the terminal pause key that stops all output until you press Ctrl-Q to resume.

3
  • what could be the reason behind providing the option to pause the terminal, just curious to know.
    – learner
    Apr 25, 2020 at 4:51
  • 3
    Sometimes it's helpful, when an application is printing lots of output non-stop, and you want to make it pause so you can read it before it disappears off screen. It's also the same control character used for software flow control, when one device wants to tell the other device to slow down for a bit. Apr 25, 2020 at 17:34
  • @learner The Control-S opton is a relict from old times up to about the 1980-ies when the computer was operated using a teletype, or teletype-like text-based video terminal. Even worse, the computer output often was concise and cryptic, so pausing was convenient to get some more time to study the messages before these would disappear past the top of the screen
    – Roland
    Nov 10, 2023 at 15:21
16

A good general way to diagnose mysterious hangs:

  1. open a(nother) terminal, and use ps axo pid,wchan:32,cmd to find the other process id
  2. note the wchan column, which should tell you whether it's stuck in the kernel
  3. run sudo strace -p PID inserting the pid of that process; paste that into a bug report or question

If there's anything aside from just a dash in the wchan column, then the process is in the kernel doing something. Some typical values:

  • futex_wait_queue_me - waiting on a futex for another thread in the same process
  • poll_schedule_timeout - waiting for network or interprocess communication, or just sleeping for a while
  • pipe_wait - reading/writing a pipe

There are thousands of possibilities so I can't list them all. See What is the "Waiting Channel" of a process? for more.

5
  • Very useful for general purpose bug tracking. Can you please update your answer with some extensive description ? What message in wchan column indicates a program that is stuck in the kernel ?
    – Salih Emin
    Nov 30, 2010 at 13:19
  • Thanks, Salih. Maybe we should have another question about how in general to diagnose hangs?
    – poolie
    Nov 30, 2010 at 21:42
  • If people are curious about any other wchan values, please add a comment.
    – poolie
    Mar 14, 2012 at 0:37
  • Any wchan means the process is waiting in the kernel. If it stays there for a long time and for no good reason like listening for network io, then it's stuck. ;)
    – poolie
    Dec 11, 2015 at 6:08
  • I have do-epoll-wait and do-wait in the wchan column related to .vscode-server which should be fine listening to remote wsl connection.
    – Timo
    Jun 20, 2021 at 7:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .