[#11569] sprintf: Format specifier tokens aren't checked well enough — Florian Gross <florgro@...>

Hi,

12 messages 2007/07/01

[#11611] Import gem to Ruby 1.9 — SASADA Koichi <ko1@...>

Hi,

130 messages 2007/07/08
[#11625] Re: Import gem to Ruby 1.9 — Eric Hodel <drbrain@...7.net> 2007/07/09

On Jul 8, 2007, at 00:49, SASADA Koichi wrote:

[#11727] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/07/17

-----BEGIN PGP SIGNED MESSAGE-----

[#11738] Re: Import gem to Ruby 1.9 — Eric Hodel <drbrain@...7.net> 2007/07/17

On Jul 17, 2007, at 01:26, NAKAMURA, Hiroshi wrote:

[#11752] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/07/18

-----BEGIN PGP SIGNED MESSAGE-----

[#11794] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/07/24

-----BEGIN PGP SIGNED MESSAGE-----

[#11820] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/07/26

-----BEGIN PGP SIGNED MESSAGE-----

[#12323] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/01

-----BEGIN PGP SIGNED MESSAGE-----

[#12330] Re: Import gem to Ruby 1.9 — Eric Hodel <drbrain@...7.net> 2007/10/01

On Sep 30, 2007, at 22:56 , NAKAMURA, Hiroshi wrote:

[#12637] Re: Import gem to Ruby 1.9 — Eric Hodel <drbrain@...7.net> 2007/10/13

On Oct 1, 2007, at 09:57 , Eric Hodel wrote:

[#12642] Re: Import gem to Ruby 1.9 — Yukihiro Matsumoto <matz@...> 2007/10/13

Hi,

[#12643] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/13

-----BEGIN PGP SIGNED MESSAGE-----

[#12645] Re: Import gem to Ruby 1.9 — Eric Hodel <drbrain@...7.net> 2007/10/13

On Oct 13, 2007, at 02:00 , NAKAMURA, Hiroshi wrote:

[#12652] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/13

-----BEGIN PGP SIGNED MESSAGE-----

[#12656] Re: Import gem to Ruby 1.9 — Eric Hodel <drbrain@...7.net> 2007/10/13

On Oct 13, 2007, at 08:00 , NAKAMURA, Hiroshi wrote:

[#12691] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/15

-----BEGIN PGP SIGNED MESSAGE-----

[#12712] Re: Import gem to Ruby 1.9 — Eric Hodel <drbrain@...7.net> 2007/10/16

On Oct 15, 2007, at 07:14 , NAKAMURA, Hiroshi wrote:

[#12717] Re: Import gem to Ruby 1.9 — "Leonard Chin" <l.g.chin@...> 2007/10/17

On 10/17/07, Eric Hodel <drbrain@segment7.net> wrote:

[#12729] Re: Import gem to Ruby 1.9 — Charles Oliver Nutter <charles.nutter@...> 2007/10/17

Leonard Chin wrote:

[#12766] Re: Import gem to Ruby 1.9 — Tanaka Akira <akr@...> 2007/10/19

In article <4710890A.3020009@sarion.co.jp>,

[#12768] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/19

-----BEGIN PGP SIGNED MESSAGE-----

[#12771] Re: Import gem to Ruby 1.9 — Tanaka Akira <akr@...> 2007/10/19

In article <4718708D.3050001@sarion.co.jp>,

[#12792] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/20

-----BEGIN PGP SIGNED MESSAGE-----

[#12798] Re: Import gem to Ruby 1.9 — Tanaka Akira <akr@...> 2007/10/21

In article <471A1720.4080606@sarion.co.jp>,

[#12827] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/22

-----BEGIN PGP SIGNED MESSAGE-----

[#12852] Re: Import gem to Ruby 1.9 — Tanaka Akira <akr@...> 2007/10/23

In article <471CAFE0.2070104@sarion.co.jp>,

[#12853] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/23

-----BEGIN PGP SIGNED MESSAGE-----

[#12854] Re: Import gem to Ruby 1.9 — Tanaka Akira <akr@...> 2007/10/23

In article <471D4D1F.5050006@sarion.co.jp>,

[#12857] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/23

-----BEGIN PGP SIGNED MESSAGE-----

[#12896] Re: Import gem to Ruby 1.9 — Tanaka Akira <akr@...> 2007/10/24

In article <471D5665.5040209@sarion.co.jp>,

[#12914] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/25

-----BEGIN PGP SIGNED MESSAGE-----

[#11642] Re: Proposal: runtime-modifying Kernel methods should be keywords — "Marcel Molina Jr." <marcel@...>

On Fri, Jul 13, 2007 at 03:02:06PM +0900, Charles Oliver Nutter wrote:

21 messages 2007/07/13
[#11671] Re: Proposal: runtime-modifying Kernel methods should be keywords — Ryan Davis <ryand-ruby@...> 2007/07/13

[#11645] Re: Proposal: runtime-modifying Kernel methods should be keywords — Charles Oliver Nutter <charles.nutter@...>

Charles Oliver Nutter wrote:

20 messages 2007/07/13
[#11646] Re: Proposal: runtime-modifying Kernel methods should be keywords — Yukihiro Matsumoto <matz@...> 2007/07/13

Hi,

[#11647] Re: Proposal: runtime-modifying Kernel methods should be keywords — Charles Oliver Nutter <charles.nutter@...> 2007/07/13

Yukihiro Matsumoto wrote:

[#11650] Re: Proposal: runtime-modifying Kernel methods should be keywords — Nobuyoshi Nakada <nobu@...> 2007/07/13

Hi,

[#11756] threads and heavy io on osx and linux — "ara.t.howard" <Ara.T.Howard@...>

15 messages 2007/07/18

[#11795] What libraries to be unbundled? — "NAKAMURA, Hiroshi" <nakahiro@...>

-----BEGIN PGP SIGNED MESSAGE-----

27 messages 2007/07/24
[#11797] Re: What libraries to be unbundled? — David Flanagan <david@...> 2007/07/24

I don't think that json should be unbundled. It is the interchange

[PATCH] Problem with ruby 1.8.6-p36 (and p39) on Tiger

From: "Vincent Isambart" <vincent.isambart@...>
Date: 2007-07-02 12:38:23 UTC
List: ruby-core #11584
Hi,

> The problem can be easily reproduced under Tiger with a one-liner:
> % ruby -ve 'require "timeout" ; Timeout.timeout(5) { puts `df -h` }'
> ruby 1.8.6 (2007-06-07 patchlevel 36) [i686-darwin8.10.1]
> /usr/local/lib/ruby/1.8/timeout.rb:54: execution expired (Timeout::Error)
>         from /usr/local/lib/ruby/1.8/timeout.rb:56:in `timeout'
>         from -e:1
I investigated more and the function that blocks is
rb_thread_cancel_timer (eval.c). This function is called in
proc_exec_v (process.h) only in 1.8.6-p36 and -p39, not in the 1.8
branch nor in 1.8.6-p0. And it is empty if pthread is not enabled.

So I investigated a little more to see what was wrong in this
rb_thread_cancel_timer function, and why everything works fine under
systems other than Tiger (Linux, Leopard...). The reason seems to be
due to a bug in Tiger. Here is a little step-by-step of what happens
when calling in Ruby system() or ``:
- the process is forked, the parent does not do much but the child do
what follows ;
- the rb_thread_cancel_timer is called to kill the timer thread.
However, as this process is a child created using fork, it has no
timer thread (fork kills all threads in the child process except the
current one), and the time_thread references a thread in the parent.
So on most systems, the pthread_cancel and pthread_join done by
rb_thread_cancel_timer both fail. But under Tiger pthread_cancel
SUCCEEDS and pthread_join HANGS.

However, after seeing in the ChangeLog why this call to
rb_thread_cancel_timer is done (cf ruby-dev:30581), it's clear that
this cannot be simply removed. However it should not be called just in
a child created by fork in C. The simplest way may be to just put
time_thread_alive_p to false in the children of forks created to start
a process (for example in pipe_open in io.c or in rb_f_system in
process.c). However I do not know well enough Ruby to be 100 % sure of
this.

I attached a small patch using pthread_atfork to do this and it solves
at least on my small tests the problem with system() or `` in
Timeout.timeout, and the problem mentioned in ruby-dev:30581 is still
corrected. But I think it needs some reviews to be sure it does not
add any problem.

Cheers,
Vincent Isambart

Attachments (1)

thread_not_alive_anymore.patch (507 Bytes, text/x-diff)
Index: eval.c
===================================================================
--- eval.c	(revision 12679)
+++ eval.c	(working copy)
@@ -11826,6 +11826,12 @@
 {
 }
 
+static void
+rb_child_at_fork(void)
+{
+    time_thread_alive_p = 0;
+}
+
 void
 rb_thread_cancel_timer()
 {
@@ -11920,6 +11926,7 @@
 #ifdef _THREAD_SAFE
 	pthread_create(&time_thread, 0, thread_timer, 0);
         time_thread_alive_p = 1;
+        pthread_atfork(NULL, NULL, rb_child_at_fork);
 #else
 	rb_thread_start_timer();
 #endif

In This Thread

Prev Next