Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Ruby 2.0.0p195 99% cpu on POW start #7

Open
microspino opened this issue Jun 6, 2013 · 6 comments
Open

On Ruby 2.0.0p195 99% cpu on POW start #7

microspino opened this issue Jun 6, 2013 · 6 comments
Assignees
Labels
Milestone

Comments

@microspino
Copy link

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.

@mlipper
Copy link
Owner

mlipper commented Jun 6, 2013

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

@mlipper
Copy link
Owner

mlipper commented Jun 6, 2013

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

@microspino
Copy link
Author

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
Copy link
Author

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

@mlipper
Copy link
Owner

mlipper commented Jun 6, 2013

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

@ghost ghost assigned mlipper Jun 6, 2013
@mlipper
Copy link
Owner

mlipper commented Jun 11, 2013

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants