runt icon indicating copy to clipboard operation
runt copied to clipboard

On Ruby 2.0.0p195 99% cpu on POW start

Open microspino opened this issue 12 years ago • 6 comments

I've tried using runt with the following ruby versions:

  • 1.9.3p327
  • 1.9.3p385

In both cases i got a recursion error somewhat hard to debug. I've tried also the Readme example in irb getting the very same error ( irb says also that it could be its own error: maybe irb bug). The Readme example and tutorials work well in ruby 1.8.7.

Reading the issues here i decided to move to ruby 2.0.0p195. I can try the tutorials in irb without any error. However if i bundle runt with my Rails 3.2.13 application the ruby process goes up to 99% of cpu usage and POW become unresponsive.

I'm on OS X Lion 10.7.5. I handle ruby versions with rbenv and ruby-build. runt gem version is updated to 0.9.0.

microspino avatar Jun 06 '13 10:06 microspino

Can you please provide code/app that demonstrates the problem and I will see if I can reproduce the issue?

mlipper avatar Jun 06 '13 12:06 mlipper

Actually, don't worry about it for now since I am able to reproduce the issue using the README.md code on Ruby v1.9.3 p3.9.2

mlipper avatar Jun 06 '13 13:06 mlipper

I can't give you all the app code but I did some troubleshooting in the meantime. A brand new Rails 3.2.13 app with this Gemfile works well.

source 'https://rubygems.org'
ruby '2.0.0'

gem 'rails', '3.2.13'


gem 'sqlite3'
gem 'runt'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

microspino avatar Jun 06 '13 13:06 microspino

This is the Gemfile from the app that shows the problem. I discovered that adding require: false on the gem 'runt' works. I mean, POW starts without eating my CPU.

source 'https://rubygems.org'
ruby "2.0.0"

gem 'rails', '3.2.13'
gem 'pg'
gem 'jquery-rails'
gem 'bcrypt-ruby', '~> 3.0.0'
gem 'cancan'
gem 'simple_form'
gem 'runt', require: false

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
  gem 'bootstrap-sass'
  gem 'jquery-ui-rails'
end

group :development do
  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'meta_request'
  gem 'pry'
  gem 'rails-erd'
  gem 'letter_opener'
  gem 'nifty-generators'
end

gem "mocha", :group => :test

microspino avatar Jun 06 '13 14:06 microspino

The issue has to do with 1.9.3/2.x handling of method_missing which is used by the syntactic extensions in the lib/runt/sugar.rb file. Either my understanding of how method_missing is no longer valid with these versions or there is a bug with the MRI interpreter itself (the issue does not appear on JRuby 1.9 or MRI 1.8.7).

I am going to re-write the sugar.rb code to avoid implementing method_missing in the Runt module. I have stuff going on at work so it may be a couple of days until I can work on this. In the meantime, if you are not using the "sugar" stuff, you can comment out the following in lib/runt.rb and everything should be ok:

require "runt/sugar" require "runt/expressionbuilder"

Thanks,

Matt

mlipper avatar Jun 06 '13 14:06 mlipper

Can you please checkout and try branch 'sugar'? In that branch, the dynamic expression stuff is in a new sub module. If you are using this functionality then you will need to add: include Runt::Sugar Please let me know if the issue still exists with this branch.

Thanks

mlipper avatar Jun 11 '13 11:06 mlipper