Forum: Ruby-core [Ruby 1.8-Bug#3779][Open] Threading issues on Debian GNU/kFreeBSD

Posted by Lucas Nussbaum (Guest)
on 2010-09-01 12:27
Attachment: 100901_threading_fixes.patch (2,65 KB)
(Received via mailing list)
Bug #3779: Threading issues on Debian GNU/kFreeBSD
http://redmine.ruby-lang.org/issues/show/3779

Author: Lucas Nussbaum
Status: Open, Priority: Normal
ruby -v: 1.8.7

Due to incorrect assumptions on sigprocmask in threaded programs, ruby 
1.8 doesn't work well on Debian GNU/kFreeBSD (FreeBSD kernel + GNU 
Libc).
This was already fixed in Ruby 1.9.

- in process.c (re-)start timer thread (after_exec) only in parent,
  as in child we know for sure that there is only one thread.
  The fix-up in child is performed slightly later in rb_thread_atfork().
  Also unify linux with rest of the systems.
  In 1.9 series the code is completely reworked.

- in signal.c use pthread_sigmask instead of sigprocmask,
  behaviour of sigprocmask is undefined in threaded programs, as stated 
in POSIX
  (http://www.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html).
  In 1.9 series the code already uses pthread_sigmask:

  Sat Apr 24 00:41:52 2010  Yusuke Endoh  <mame@tsg.ne.jp>

        * signal.c: use pthread_sigmask() instead of sigprocmask().
          sigprocmask() is unspecified behavior on multi-thread 
programs.
          [ruby-core:25217]

For more information, see 
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=595034

Patch attached. The signal.c part is hackish, and should be done 
properly in configure.

Please also backport to 1.8.7.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.