Project

General

Profile

Actions

Bug #4939

closed

Signal handling does not working if single grave accent ( ` ) initiated command was issued before Signal.trap

Added by senotrusov (Stanislav Senotrusov) over 13 years ago. Updated over 13 years ago.

Status:
Third Party's Issue
Target version:
-
ruby -v:
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
Backport:
[ruby-core:37578]

Description

If grave accent ( ) shell command (whoami` in the following case) is called BEFORE Signal.trap,
the signals will not be handled, and ruby default handling behavior also did not work.

Basically, when I press Ctrl+C or send kill -TERM nothing happens - the process continues to run (or sleep(60) in that case).

This whoami call prevents the following signal handlers from working

Just comment this line and signal handling will be ok

STDOUT.write whoami

STDOUT.puts "Press Ctrl+C"

Signal.trap(:INT) { STDOUT.write "GOT INT\n"; exit! }
Signal.trap(:TERM) { STDOUT.write "GOT TERM\n"; exit! }

sleep 60

Actions #1

Updated by nahi (Hiroshi Nakamura) over 13 years ago

  • Project changed from Ruby 1.8 to Ruby master
  • Category changed from core to core
  • Status changed from Open to Feedback
  • Assignee set to nahi (Hiroshi Nakamura)

Updated by nahi (Hiroshi Nakamura) over 13 years ago

Looks similar to #4777. Would you please see that issue and try the resolution? (Updating Linux Kernel to 2.6.38.4 or later)

Updated by senotrusov (Stanislav Senotrusov) over 13 years ago

Thank you for pointing #4777. I've just read it and found it similar.

As it #4777 in my case when I sent CONT signal, the previously ignored TERM is handled well.

I'm running test case on Ubuntu 11.04 (Linux foo 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 i686 i686 i386 GNU/Linux) and think the 2.6.38.4 you suggested is older than my kernel (don't know really how to relate -8 and .4 in version)

Now I've try to upgrade to the 2.6.39 kernel as Peter Sanford mentioning in #7 comment on issue #4777.

And, I think I've observed issue #4608 with 100% CPU load, but did not isolate then well.

Updated by senotrusov (Stanislav Senotrusov) over 13 years ago

The problem disappears after upgrade to Linux foo 2.6.39-0-generic #5~20110427-Ubuntu SMP Wed Apr 27 17:41:08 UTC 2011 i686 i686 i386 GNU/Linux using kernel-ppa.

I've suggest it's not a Ruby bug.

Thank you.

Updated by kosaki (Motohiro KOSAKI) over 13 years ago

  • Status changed from Feedback to Third Party's Issue

I've suggest it's not a Ruby bug.

Then, closed. ;-)

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0