Subject:
[ruby-ffi] Re: Null Pointer Issue? Am I Racing with the Garbage Collector?
From:
Scott Gonyea
Date:
11/13/10 8:04 PM
To:
ruby-ffi

So it's still going to blow up in bizarre ways?  I'll try it out from
the github master.  Thank you.

On Nov 13, 5:09 am, Wayne Meissner <wmeiss...@gmail.com> wrote:
> I think those changes fixing things is purely coincidental.
>
> I think the reason why ffi from github was raising errors, was because
> the enum parameter handling was slightly broken (it only accepted enum
> constants, not ints), so update, re-install it and see if it works
> now.
>
> On 13 November 2010 08:50, Scott Gonyea <gon...@gmail.com> wrote:
>
>
>
> > Well that's weird.  Now it's all working in MRI.  I'm not sure which
> > of my changes helped, or if I sleep-walked last night after one of my
> > lobes declared a coup.
>
> > Here's what I did with CurlFFI:
>
> >https://github.com/aitrus/curl_ffi/commit/3e72173c9f60238f855c6e23f54...
>
> > And here's what I did in StreamlyFFI:
>
> >https://github.com/aitrus/streamly_ffi/commit/48568e7792cd7bc8a300d0f...
>
> > I need to go back and remove my frantic use of ".dup" and see what the
> > effect is.  I should probably walk back my changes to see where it
> > went right.
>
> > Scott
>
> > On Nov 11, 11:09 pm, Scott Gonyea <gon...@gmail.com> wrote:
> >> Interesting.  I used JRuby (1.5.3) and the ffi gem (0.6.3 /
> >> rubygems.org).  Works just peachy.  I ran it at 50 and then 100
> >> iterations.  Everything seems to get along.
>
> >> sgonyea@skg:~/Sites/gsolr$ ruby bench.rbhttp://toddler.tomkittens.com:8080/solr
> >> "hi"
> >> Rehearsal ------------------------------------
> >>  GSolr
> >>   4.626000   0.000000   4.626000 (  4.626000)
> >>  RSolr
> >>   9.435000   0.000000   9.435000 (  9.436000)
> >> -------------------------- total: 14.061000sec
>
> >>        user     system      total        real
> >>  GSolr
> >>   3.523000   0.000000   3.523000 (  3.523000)
> >>  RSolr
> >>   8.903000   0.000000   8.903000 (  8.903000)
> >> sgonyea@skg:~/Sites/gsolr$ ruby bench.rbhttp://toddler.tomkittens.com:8080/solr
> >> "hi"
> >> Rehearsal ------------------------------------
> >>  GSolr
> >>   8.134000   0.000000   8.134000 (  8.134000)
> >>  RSolr
> >>  18.710000   0.000000  18.710000 ( 18.710000)
> >> -------------------------- total: 26.844000sec
>
> >>        user     system      total        real
> >>  GSolr
> >>   6.805000   0.000000   6.805000 (  6.805000)
> >>  RSolr
> >>  17.557000   0.000000  17.557000 ( 17.557000)
>
> >> Scott
>
> >> On Nov 11, 11:01 pm, Scott Gonyea <gon...@gmail.com> wrote:
>
> >> > Strange.  I replied in my e-mail, but it didn't post.  Hoping it
> >> > wasn't plugged up in Google somewhere.  Here's what I wrote:
>
> >> > I'm pretty sure it does.  I ran into another issue, while using the
> >> > FFI from Github:
>
> >> >https://gist.github.com/673816
>
> >> > I'm checking the values, all along the way, and I'm not handing it any
> >> > nils, but it won't believe me. The ffi 0.6.3 gem won't complain about
> >> > this (but it will blow up at a few spots).
>
> >> > Sigh :(  Thank you very much, for your help.
>
> >> > Scott
>
> >> > On Nov 11, 10:21 pm, Wayne Meissner <wmeiss...@gmail.com> wrote:
>
> >> > > Thats interesting.
>
> >> > > Does curl use threads internally?  If so, build the ffi gem from
> >> > > github and try that.  Earlier versions don't deal well with callbacks
> >> > > coming from non-ruby threads.
>
> >> > > Also try running it with JRuby.  It handles threads a lot better.
>
> >> > > On 12 November 2010 15:25, Scott Gonyea <gon...@gmail.com> wrote:
>
> >> > > >https://gist.github.com/673753
>
> >> > > > That will show you the script I'm running, the gdb backtrace, and ruby-
> >> > > > prof (if that helps at all).  I basically was benchmarking my library
> >> > > > with the one I started branching from.  It's all good, until I start
> >> > > > running a whole lot of iterations.  I made some changes, which seems
> >> > > > to have made it less frequent... until I up the number of iterations.
>
> >> > > >https://github.com/aitrus/curl_ffi/commit/99a231aea24b2d7d63bccaa5c23...
>
> >> > > > That was the one fix.  This GSolr junk of mine uses StreamlyFFI and
> >> > > > CurlFFI:
>
> >> > > > StreamlyFFI:https://github.com/aitrus/streamly_ffi
> >> > > > CurlFFI:https://github.com/aitrus/curl_ffi
>
> >> > > > Scott