Processes do not respond to my signals

5,736

Recent versions of the nVidia proprietary drivers (possibly combined with other recent versions of libraries) have a bug which causes them to corrupt the signal mask.

You can look at signal masks like this:

anthony@Zia:~$ ps -eo blocked,pid,cmd | egrep -v '^0+ '
         BLOCKED   PID CMD
fffffffe7ffbfeff   605 udevd --daemon
0000000000000002  4052 /usr/lib/policykit-1/polkitd --no-debug
0000000000087007  4646 /usr/sbin/mysqld --basedir=/usr […]
0000000000010000 15508 bash

That's about what it should look like. If you run that on a system with the proprietary nVidia drivers, you'll see all kinds of crazy values for BLOCKED, for many of your programs—including, likely, all the misbehaving ones.

Note that signal masks are passed from parent to child through fork/exec, so once a parent process has a corrupt one, all the children it spawns from that point forward will, too.

See also my question After upgrade, X button in titlebar no longer closes xterm and various distro bugs you'll be able to find now, knowing which package to look at. You can modify the code in my answer to that question to reset the signal mask to none blocked (Elide sigaddset and change SIG_UNBLOCK to SIG_SETMASK).

Share:
5,736

Related videos on Youtube

Maxwell S.
Author by

Maxwell S.

Updated on September 18, 2022

Comments

  • Maxwell S.
    Maxwell S. over 1 year

    I have a strange behavior on my system.

    When I invoke a command in the shell (bash version 4.2.45(1)-release), say top or cat, the running program (the process) does not respond to Ctrl+C. I even tried to run kill -2 <pid> and kill -15 <pid>, but it didn't help. However, I can kill processes with SIGKILL.

    I own the process, I even tried to send a signal to the process (signals 2 and 15) as root but it did not respond. I can quit top if I press q.

    Any ideas about the problem? Or any hint to troubleshoot it?

    UPDATE 1

    cat and top were just examples. All processes have the same behavior. I tried to write a simple program to sleep only (without signal handler) and I had the same behavior.

    UPDATE 2

    I wrote a small program to sleep only. This time I installed signal handler to catch SIGTERM and SIGINT. When I invoked kill -15 <pid> (and so with -2), my program did not receive the signal!

    I also updated the kernel to 3.11.10-100.fc18.i686 and still having the same problem.

    • derobert
      derobert over 10 years
      Do you happen to be using the nVidia proprietary drivers? If so, you're seeing unix.stackexchange.com/questions/107331/…
    • Maxwell S.
      Maxwell S. over 10 years
      @derobert true! the reason was the nvidia proprietary driver! can you please write a full answer to accept it.
    • derobert
      derobert over 10 years
      Added an answer. I guess this warrants enough explanation to not mark the question a duplicate (and to be clear, no, you were not expected to find the other question. This is a very confusing bug...)
  • Maxwell S.
    Maxwell S. over 10 years
    Thank you for your answer. cat and top is just examples. all processes do the same behavior. i tried to write a simple program to sleep only ( without signal handler) and i had the same behavior.
  • Admin
    Admin over 10 years
    @MaxwellS. - see edits. Maybe your keyboard/tty settings are messed up.
  • Maxwell S.
    Maxwell S. over 10 years
    i think the tty driver is okay intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; please note that i also invoked kill program to send signals