[#80531] Re: [ruby-cvs:65407] normal:r58236 (trunk): thread.c: comments on M:N threading [ci skip] — Eric Wong <normalperson@...>

SASADA Koichi <ko1@ruby-lang.org> wrote:

24 messages 2017/04/02
[#80532] Re: [ruby-cvs:65407] normal:r58236 (trunk): thread.c: comments on M:N threading [ci skip] — SASADA Koichi <ko1@...> 2017/04/02

On 2017/04/02 11:35, Eric Wong wrote:

[#80540] Re: [ruby-cvs:65407] normal:r58236 (trunk): thread.c: comments on M:N threading [ci skip] — Eric Wong <normalperson@...> 2017/04/03

SASADA Koichi <ko1@atdot.net> wrote:

[#81027] Re: [ruby-cvs:65407] normal:r58236 (trunk): thread.c: comments on M:N threading [ci skip] — Eric Wong <normalperson@...> 2017/05/08

Eric Wong <normalperson@yhbt.net> wrote:

[#81028] Re: [ruby-cvs:65407] normal:r58236 (trunk): thread.c: comments on M:N threading [ci skip] — SASADA Koichi <ko1@...> 2017/05/08

On 2017/05/08 9:33, Eric Wong wrote:

[#81029] Re: [ruby-cvs:65407] normal:r58236 (trunk): thread.c: comments on M:N threading [ci skip] — SASADA Koichi <ko1@...> 2017/05/08

On 2017/05/08 10:53, SASADA Koichi wrote:

[#81031] Re: [ruby-cvs:65407] normal:r58236 (trunk): thread.c: comments on M:N threading [ci skip] — Eric Wong <normalperson@...> 2017/05/08

SASADA Koichi <ko1@atdot.net> wrote:

[#81033] Re: [ruby-cvs:65407] normal:r58236 (trunk): thread.c: comments on M:N threading [ci skip] — SASADA Koichi <ko1@...> 2017/05/08

On 2017/05/08 12:01, Eric Wong wrote:

[#81035] Re: [ruby-cvs:65407] normal:r58236 (trunk): thread.c: comments on M:N threading [ci skip] — Eric Wong <normalperson@...> 2017/05/08

SASADA Koichi <ko1@atdot.net> wrote:

[#81042] Re: [ruby-cvs:65407] normal:r58236 (trunk): thread.c: comments on M:N threading [ci skip] — SASADA Koichi <ko1@...> 2017/05/09

On 2017/05/08 15:36, Eric Wong wrote:

[#81044] Re: [ruby-cvs:65407] normal:r58236 (trunk): thread.c: comments on M:N threading [ci skip] — Eric Wong <normalperson@...> 2017/05/09

SASADA Koichi <ko1@atdot.net> wrote:

[#81045] Re: [ruby-cvs:65407] normal:r58236 (trunk): thread.c: comments on M:N threading [ci skip] — SASADA Koichi <ko1@...> 2017/05/09

On 2017/05/09 12:38, Eric Wong wrote:

[#81047] Re: [ruby-cvs:65407] normal:r58236 (trunk): thread.c: comments on M:N threading [ci skip] — Eric Wong <normalperson@...> 2017/05/09

SASADA Koichi <ko1@atdot.net> wrote:

[ruby-core:80838] [Ruby trunk Bug#13501] Process.kill behaviour for negative pid is not documented and may be wrong

From: tadump+ruby-lang@...
Date: 2017-04-23 23:05:06 UTC
List: ruby-core #80838
Issue #13501 has been reported by toy (Ivan Kuchin).

----------------------------------------
Bug #13501: Process.kill behaviour for negative pid is not documented and may be wrong
https://bugs.ruby-lang.org/issues/13501

* Author: toy (Ivan Kuchin)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.2.7p470 (2017-03-28 revision 58194) [x86_64-darwin14]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
Following code will not fail and will print "TERM caught by NN" both for spawned and forked processes:

~~~ ruby
pid = spawn 'ruby', '-e', <<-'RUBY', :pgroup => true
  trap('TERM'){ print "TERM caught by #{$$}\n" }
  fork
  sleep 10
RUBY
sleep 1
Process.kill('TERM', -pid)
~~~

Documentation explains such behaviour for using negative signal (or a string starting with '-'), but not negative pid.

[linux](https://linux.die.net/man/2/kill), [osx](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man2/kill.2.html) and [POSIX](http://pubs.opengroup.org/onlinepubs/009695399/functions/kill.html) documentation for `kill` describes behaviour for negative pid is to send signal to process group.

As `Process.kill` is [using `killpg`](https://github.com/ruby/ruby/blob/e97ac02f8466275732a33f704480c03da722f485/signal.c#L464) if it is defined, the behaviour may be undefined on systems with `killpg` present but `kill` not conforming to `POSIX` specification.
Also sending negative `signal` with negative `pid` will call `killpg` with negative `pid`.




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next