ruby18, -pthreads, deep recursion

Jeremy Messenger mezz7 at cox.net
Thu Nov 1 20:34:02 PDT 2007


On Thu, 01 Nov 2007 16:04:35 -0500, lemon <lemon+freebsd at zomo.co.uk> wrote:

> Hi,
>
> I've been struggling with FreeBSD's ruby18 port and threads. I realise
> there's previous discussion[0] about this and I feel I'm blundering
> somewhat, but here goes.
>
> On both 7.x and 6.x boxes I've built ruby18 with the pthreads knob
> deliberately turned off (the default). The resultant ruby has problems
> with deep recursion, shown by this script[1] but less pathologically in
> production in a busy RoR site too.
>
>   $ ruby -e 'def d(x); p x; d x+1; end; d 0'
>
> This bombs with SIGILL[2].
>
> I note that, as per the conversations linked above, this build uses the
> GCC option -pthread and links against libthr[3].
>
> If I build the port without -pthread (and related config.h #define),
> install the library alongside the from-port one, and employ the
> resultant binary with some libmap.conf guidance I get a ruby which
> behaves far nicer[4]. I can recurse way deeper and receive a graceful
> SystemStackError exception when things hit the wall[5].
>
> What's the score here? Clearly there's motive for building like it does,
> but the hacked ruby works better for me in everyday life. Any ideas?
>
> I hope this is on-topic for freebsd-ports. I mailed the maintainer first
> but got no response.

People did a lot of test for lofi and me. You can see  
http://freebsd.rambler.ru/bsdmail/cvs-all_2005/msg08680.html ... Have ruby  
compiles without -pthread breaks more stuff than with -pthread. But we  
can't enable thread option because it also break more stuff than disable  
thread support. Weird?

As for your problem of ruby with -pthread. I have known about that problem  
and there used to have a PR of it, but I can't find that PR. It was only a  
problem that ruby with -pthread is causing.

I am not going to work on ruby all over again, so don't ask me. :-) I am  
hoping that someone can bring 100% solution, but we haven't get Mr. Right  
for ruby yet. Maybe Ruby 1.9 or 2.x with new VM/thread will solve this  
problem or not.

Cheers,
Mezz

> Regards, l.
<snip>


-- 
mezz7 at cox.net  -  mezz at FreeBSD.org
FreeBSD GNOME Team  -  FreeBSD Multimedia Hat (ports, not src)
http://www.FreeBSD.org/gnome/  -  gnome at FreeBSD.org
http://wiki.freebsd.org/multimedia  -  multimedia at FreeBSD.org


More information about the freebsd-ports mailing list