[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#593141: Bug#653582: ruby-hpricot: FTBFS on ia64: ruby crashes while running tests

On Fri, Dec 07, 2012 at 10:21:57PM +0100, Stephan Schreiber wrote:
> I took a look at this a few weeks ago.
> The problem is the code in the cont.c file which implements continuations.
> A thread saves its own stack and its thread context itself while it
> is running. The ruby programmers believe that that the saved info
> can be used by another thread to switch over. They are wrong!
> This is simply ill-formed code; wrong usage of the
> makecontext()/swapcontext() functions. It is a miracle that it works
> on other architectures - on sparc it did after doing some dirty
> tricks.
> The problem causes crashes which are almost impossible to understand
> with the debugger.
> The code was written in 2007 and made a lot of trouble until now;
> when you take a look to cont.c, you are see some really weird code
> fragments - dirty hacks to workaround some fundamental design flaws.
> I'm not satisfied with the code quality of the ruby project at all;
> I don't understand how it could be included in a ruby version that
> is for production use.
> So the continuations and perhaps some related threading features are
> broken - very advanced and new features in Ruby.
> I think a fix is feasable for platforms which use
> makecontext()/swapcontext() - as Linux is (rather than Windows Win32
> functions).
> What can be implememnted is that a thread switches to another
> context/stack; the initial context/stack is saved after that. The
> thread switches back to the initial context/stack finally.
> This means:
> - The performance becomes worse due to additional context switches.
> I think it isn't that bad; the ruby code copies over huge portions
> of memory in its implementation all the time; the entire original
> code is a huge performance penalty (if it wouldn't crash). I don't
> believe that the additional context switches makes it noticeable
> worse.
> - The patch would be a real patch bomb. It would remove a lot of
> mess for (not working) ia64 workarounds and the most recent sparc
> patches of Debian as well. The patch replaces a lot of code of
> cont.c.
> - The patch would change the implementation for all Debian archs,
> not only ia64.
> I appreciate comments on that.

Sounds good to me. It will be awesome if you could do that! :-)

I would say let's get that patch written, test it, make sure it doesn't
break anything, and them we can talk to upstream. I am not comfortable
with carrying such a huge patch on the Debian package, since I do not
have much experience of such low-level stuff.

> For now I'd prefer the 'wheezy-ignore' rather than removing the ia64
> ruby package.

Looks like this should be the way to go.

Antonio Terceiro <terceiro@debian.org>

Attachment: signature.asc
Description: Digital signature

Reply to: