banister/binding_of_caller

Ruby 2.0 support

neersighted opened this issue · 58 comments

I took a whack at it today, but hit a wall (vm_core.h has been refactored significantly), and I was unable to get it to build.

Does anyone else have enough knowledge of Ruby's internals to get it building on 2.0?

There's some preliminary work on a branch, but I think we'll have to rethink it quite a lot to use the debugger api created here http://bugs.ruby-lang.org/issues/7214

Thanks for the link. I tossed it over to BetterErrors/better_errors#82.

I have binding_of_caller rewritten using the 2.0 debugging API (on a local branch) but it segfaults, there's an issue filed on redmine about it, if ko1 doesn't fix it then we'll have to fix it ourselves :)

@banister I saw the issue. For those interested: http://bugs.ruby-lang.org/issues/7635

I'll look into the segfault tonight (no guarantees, I've never hacked on MRI before).

Hmm, I hope the mri dudes have this on their radar for 2.0. Any related changes in todays RC1? :/

Not really, I'm still getting similar errors on rc1 and yesterday's head, so basically no.

I am not surprised.

@neersighted @banister, http://bugs.ruby-lang.org/issues/7635 is fixed. @banister can you test this against your local branch?

@gavinhughes yep:) I'll test soon

@gavinhughes Thank you, I also tossed it over to @charliesome's better_errors.

Using rvm 'ruby-head' (works out to "ruby 2.0.0dev (2013-02-04)" today) binding_of_caller 0.6.8 does not install cleanly. Is the mri fix not backwards compatible perhaps? That is, we need an updated BoC gem too?

Yeah, I need to release a new gem, I'll try to do it by tomorrow

Any new on this issue?

all tests now passing on ruby 2.0, but i need to play around with it a bit more until im convinced it's robust enough to push a gem :)

Yay!

On Fri, Feb 8, 2013, at 03:33 PM, John Mair wrote:

all tests now passing on ruby 2.0, but i need to play around with it a
bit more before im convinced it's robust enough to push a gem :)


Reply to this email directly or view it on GitHub:
#10 (comment)

Neer Sighted {01DC2056}

http://neersighted.com | https://github.com/neersighted

Thanks for working on this!!

tried using it from the ruby-2.0 branch just now and it installed but errored out when I tried to use it with better_errors

dyld: lazy symbol binding failed: Symbol not found: _rb_vm_make_env_object
Referenced from: /Users/xxxxx/.rvm/gems/ruby-2.0.0-rc1/bundler/gems/binding_of_caller-53f04e1c7a9a/lib/binding_of_caller.bundle
Expected in: flat namespace

dyld: Symbol not found: _rb_vm_make_env_object
Referenced from: /Users/xxxxx/.rvm/gems/ruby-2.0.0-rc1/bundler/gems/binding_of_caller-53f04e1c7a9a/lib/binding_of_caller.bundle
Expected in: flat namespace

Trace/BPT trap: 5

@concept47 ...i haven't released the 2.0-friendly gem yet. :)

The new ruby 2.0 compatible gem is under development
So wait until it is released

@banister can you push it to ruby-2.0?

i haven't released the 2.0-friendly gem yet. :)

@banister ... oh I was aware of this, I didn't mean it as any sort of indictment. When you said the tests passed I just thought it would be close enough to production ready for my needs, and I was bringing it to your attention in case you missed it.

Like I said, I really appreciate the work on this ... better errors and this gem have completely changed the way me and my entire team are doing rails development.

Happy to pitch in and help if you need it in any way.

@concept47, ah. I haven't actually pushed it to github yet either :)

ah gotcha. My mistake.

I released a --pre gem, could you guys try that out with better_errors and so on? the prerelease is called 0.6.9pre2 you can install the gem via: gem install binding_of_caller --pre or in your Gemfile as gem "binding_of_caller", "~> 0.6.9.pre2" (i think).

I also merged my changes into master which are now pushed to github

I think people should use >= instead of ~> unless newer version might have breaking changes

I have tsted with 0.6.9.pre2
I can run the server and see the errors

But sometimes when I click on a "frame" to look at the source file
It only shows Session expired
But this might be better errors bug...I am not sure

I get this error when I run it with ruby 2.0.0-rc1 and puma or thin
https://gist.github.com/concept47/70dc211f8a2926377506

@concept47 it requires rc2 at least

BTW is it usable on ruby 1.9.3?
Haven't tested that.

@concept47 I got mine working on rc2, at least installed with bundler:
Installing binding_of_caller (0.6.9pre2) with native extensions

@HangingClowns did it work just as 1.9.3 worked, were there any quirks?

@banister I haven't fully been able to use it. I just took my project from 1.9.3 to 2.0 and so many gems need to be updated. Plus I'm behind the GFW and it seems rubygems.org and GFW dont' agree or they are having issues again, so it's taken me over 5 hours to even get as fair as installing this gem, but it should work. Will update if it doesn't work, though.

@HangingClowns thanks, i would also like an update if it does work, too ;)

Guess I will test the pre2 with 1.9.3 tomorrow

@PikachuEXE the current gem should already work with 1.9.3, the recent work (and the pre) is strictly for ruby 2.0 support.

Then I hope Ruby 2.0.0 can be released as scheduled!
(And then wait for Rails 4 zzz)

You can download and try 2.0.0-rc2 now: http://ftp.ruby-lang.org/pub/ruby

On 13/02/2013, at 10:34 PM, PikachuEXE notifications@github.com wrote:

Then I hope Ruby 2.0.0 can be released as scheduled!
(And then wait for Rails 4 zzz)


Reply to this email directly or view it on GitHub.

I know...that's what I tested with...
I mean the stable version scheduled to be released on 24, Feb (without RC) :P

Was not able to get better errors to come up? Not sure why, maybe it's cause I have a catch all route?

@HangingClowns I don't think so
Try to raise an error in a controller

@PikachuEXE actually kind of traced down the issue to something with the asset pipeline. I'm going to try to update my therubyracer gem, now, to see if that fixes it. I also made an issue on less-rails gem, cause I'm not quite sure where the problem is. It took 8 minutes to compile my assets... 8 minutes... Thats' why I got nothing back.

I was playing with my app too and it took so long (much longer than 8 minutes) to compile all the assets
(I was compiling for the first time)
But everything seems fine after the asset compilation
But that should not be the problem of this gem

No, i Know its not the problem of this gem. So why does it take so long time to compile? This is normal? Can't be? 1.9.3 is almost instantaneous. more like about 10 seconds and it goes.

Maybe try compiling with 1.9.3 and 2.0.0 and compare the speed?

I'm still having a hell of a time trying to pull in gems from rubygems recently. Whatever they did messed stuff up bad for me. They changed around the API so you can't request more than 100 gems at a time, or else the bundler just gets the whole index. Precompile with time:

1.9.3: bundle exec rake assets:precompile 117.96s user 9.56s system 77% cpu 2:44.27 total
2.0.0-rc2: bundle exec rake assets:precompile 101.15s user 8.80s system 89% cpu 2:03.28 total

So it's actually quicker, but it seems something is wrong with the rails s? Should I switch to something besides webbrick?

That's why I cannot bundle today- -
I don't think the slowness of live compile is due to web server
I tried thin and unicorn and both are slow

Could you try to clear cache and try the live compile in dev with 1.9.3?
Not sure if it's gem problem or ruby 2.0.0 problem

something wrong with live compile in 2.0. Any ideas on who the blame is for?
1.9.3: Completed 200 OK in 25163ms (Views: 25160.9ms | ActiveRecord: 0.0ms)
2.0: Completed 200 OK in 98820ms (Views: 98815.9ms | ActiveRecord: 0.0ms)

No idea....
But it should be asset side...
sprocket?

Left an issue on rails/rails#9279. If you can, leave your findings, too. I'd like to get this solved ASAP, at least before ruby 2.0 release.

I guess I need to wait til the bundler dependency API is fixed

Thanks! Trying it out...

Still cannot bundle
Need to install gems one by one= =

Very strange, my friend. If it hangs, try to kill it and restart it. I'm not sure what to tell you. Iv'e spent more than a day on it and now it's all working, I don't dare to update anything for a while, now.

Got it all working (better_errors, Ruby 2.0.0-rc2, 0.6.9 gem), but it seems to slow down things a lot:

With binding_of_caller:
time rails runner "puts 'hi'"
hi

real 0m15.633s
user 0m14.182s
sys 0m1.054s

Without:
time rails runner "puts 'hi'"
hi

real 0m6.225s
user 0m4.951s
sys 0m0.997s

Any idea what's going on?

Yeah, I can confirm this, can we reopen this issue or make another one to fix this? I commented it out and my previous problem is now gone.

I'm quite busy at the moment, i'll have another look at it in a week or so.

After some profiling I found out that mostly better_errors is to blame:
BetterErrors/better_errors#124
(includes a workaround for Rails apps).

Still, some performance improvements (mri2.rb seems to be way slower) would be great.