On 30/08/11 at 20:18 +0200, Petr Salinger wrote:
> >Could you try this version:
> ><---
> >a = []
> >trap(:INT) { puts "INT recvd" ; a.push(1) }
> >trap(:TERM) { puts "TERM recvd" ; a.push(2) }
> >pid = $$
> >puts "parent pid: #{pid}"
> >begin
> > fork do
> >   puts "child pid: #{$$}"
> >   sleep 0.5
> >   Process.kill(:INT, pid)
> >   Process.kill(:TERM, pid)
> >   puts "signals sent."
> > end
> > sleep 1
> > a.sort
> > p a
> >rescue NotImplementedError
> > [1, 2]
> >end
> >---->
> 
> parent pid: 44147
> child pid: 44150
> signals sent.
> []
> 
> According to ktrace, signals are sent to parent pid.
> It might be related to our pid semantic, each thread have different pid.
> The signal cannot be received by a different thread.

Arg. If I remember correctly, ruby expects signals to be handled by one
specific thread of the interpreter. Since they have different pids, it's
possible that they are not sent to the right thread.

> >>#934 test_thread.rb:389:in `<top (required)>':
> >>     open("zzz.rb", "w") do |f|
> >>       f.puts <<-END
> >>         begin
> >>           m = Mutex.new
> >>           Thread.new { m.lock; sleep 1 }
> >>           sleep 0.3
> >>           parent = Thread.current
> >>           Thread.new do
> >>             sleep 0.3
> >>             begin
> >>               fork { GC.start }
> >>             rescue Exception
> >>               parent.raise $!
> >>             end
> >>           end
> >>           m.lock
> >>           pid, status = Process.wait2
> >>           $result = status.success? ? :ok : :ng
> >>         rescue NotImplementedError
> >>           $result = :ok
> >>         end
> >>       END
> >>     end
> >>     require "./zzz.rb"
> >>     $result
> >>  #=> "" (expected "ok")
> >>FAIL 2/937 tests failed
> >>make: *** [yes-btest-ruby] Error 1
> >
> >Very strange. What about this script?
> 
> May be not.
> 
> For what should "Process.wait2" wait ?
> 
> The fork of garbage collector and wait2 seems be by a different thread,
> which with our pthread implementration does not work.

Indeed.

So, I don't know what to do.

How likely are those problems to be fixed in kfreebsd?

- Lucas



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to