Ruby stack level too deep exception NOT from recursive infinite loop - ruby

EDIT : (SOLVED) actually it probably was raised BECAUSE OF an infinite loop
I was coding and after adding a method I got this :
user_name#the_computer:/media/ECC3-C3B0/Prog/mts/src/mts$ rake test --trace
** Invoke test (first_time)
** Execute test
/home/user_name/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36: stack level too deep (SystemStackError)
rake aborted!
Command failed with status (1): [/home/user_name/.rvm/rubies/ruby-1.9.3-p19...]
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `call'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `sh'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `sh'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:82:in `ruby'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `ruby'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/testtask.rb:99:in `block (2 levels) in define'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:60:in `verbose'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/testtask.rb:98:in `block in define'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/home/user_name/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/bin/rake:19:in `load'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/bin/rake:19:in `<main>'
/home/user_name/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
/home/user_name/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => test
I'm pretty sure there is no infinite recursive loop involved.
The code is for now somehow gemified, but I also got the error running the ruby file directly.
Thank you for any help on how to (get some information to, run some tests to) fix the problem, if possible without having to rewrite the whole thing...
Environment :
ruby 1.9.3p194 / rails 3.2.8, installed via rvm
the program at this stage only uses rails string inflexions functions
OS : linux kubuntu i386
memory 4GO
'ulimit -s' : 8192 (stack size in kB)
What I tried unsuccessfully :
removed the chunk of code where the exception was initially raised, but it was still raised a tiny bit later at runtime
set stack size with command line 'ulimit -s 20000', 'ulimit -s unlimited'. Same error, apparently at the same place (which makes me think the stack size wasn't actually changed)
downgraded to ruby1.9.2 / rails3.1.3, got the same message
same error under Windows
Application context :
I'm writing an application that heavily uses ruby mixins.
Besides I created a bunch of classes that generate mixins (instance / class methods modules to be included by other classes).
So all in all I end up with quite a bit of generated named modules with some custom generated code, and classes with many ancestors.
But that should eventually save me quite a bit of pain in the as$ when I write the program that sits on top of this lib (that's the plan anyway).
Resources I used :
How to increase stack size for a ruby app. Recursive app getting: Stack level too deep (SystemStackError)
http://dalibornasevic.com/posts/5-ruby-stack-level-too-deep-systemstackerror
EDIT : Until some code is available for the showing/testing, let's abstract my question down to this one : Are there other cases that raise stack level too deep exception, besides the classical program-execution-tree-is-too-deep scenario (crossing fingers it's clear and means something...) ?

Are there other cases that raise stack level too deep exception, besides the classical program-execution-tree-is-too-deep scenario?
Yes. Since the stack is not measured in depth, but in bytes, anything stored on the stack will fill it up sooner:
def recurse(depth=0)
recurse depth+1
rescue SystemStackError
depth
end
=> nil
recurse
=> 8717
def recurse(depth=0)
a,b,c = 1,2,3
recurse depth+1
rescue SystemStackError
depth
end
=> nil
recurse
=> 7264
def recurse(depth=0)
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z = *(0..25)
recurse depth+1
rescue SystemStackError
depth
end
=> nil
recurse
=> 3187
In this example, a function with only one variable can go several thousand calls deep before failing, and adding three more variables does very little; but adding 26 more variables balloons the stack size to a point where only around 3000 levels are available.
This will, of course depend somewhat on the ruby implementation, and the system it's running on. But I believe it will always hold as a general rule.
However, I still think recursion is likely your problem, since the number of variables required to have this happen at small call chain lengths is immense.

Related

Ruby/Cucumber Error: Step definitions must always have a proc or symbol

My automation test suite for an application is written using Ruby/Cucumber. When I try to run the tests using the cucumber command, and I receive the following error: Step definitions must always have a proc or symbol. I can't find any references to this error online except for the source code itself.
Full stack trace:
Step definitions must always have a proc or symbol (Cucumber::Glue::StepDefinition::MissingProc)
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/glue/step_definition.rb:29:in `new'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/glue/registry_and_more.rb:83:in `register_rb_step_definition'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/glue/dsl.rb:31:in `register_rb_step_definition'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/glue/dsl.rb:133:in `register_rb_step_definition'
C:/Users/westoa1/dev/eclipse-workspace/rms-quality-manager/cucumber/features/step_definitions/data_steps.rb:75:in `<top (required)>'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/glue/registry_and_more.rb:107:in `load'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/glue/registry_and_more.rb:107:in `load_code_file'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime/support_code.rb:144:in `load_file'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime/support_code.rb:85:in `block in load_files!'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime/support_code.rb:84:in `each'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime/support_code.rb:84:in `load_files!' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime.rb:272:in `load_step_definitions'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime.rb:68:in `run!'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/cli/main.rb:34:in `execute!'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/bin/cucumber:9:in `<top (required)>'
C:/Ruby25-x64/bin/cucumber:23:in `load'
C:/Ruby25-x64/bin/cucumber:23:in `<main>'
I searched through my step definition files and found an incomplete step definition with no block:
Given 'There is a user'
The block was removed while resolving merge conflicts, and completing the step definition solved the error:
Given 'There is a user' do
(do stuff)
end

How to run Prometheus Ruby Client

I want to run the Prometheus Ruby Client, to gather statistics values and to save in the Prometheus database.
I've followed the instructions here : Rack middleware
https://github.com/prometheus/client_ruby#rack-middleware
I've installed two gems, prometheus and prometheus-client.
The exporter.rb (https://github.com/prometheus/client_ruby/blob/master/lib/prometheus/middleware/exporter.rb) and the collector.rb (https://github.com/prometheus/client_ruby/blob/master/lib/prometheus/middleware/collector.rb) is saved in the location: prometheus/middleware
I've saved the config.ru (https://github.com/prometheus/client_ruby#rack-middleware) in the local folder.
Then I've started the rack web server with: rackup -d config.ru -I /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/prometheus-client-0.6.0/lib -I /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/quantile-0.2.0/lib
The -I include statement is necessary to let find the required files.
Then I got this error :
/home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/prometheus-client-0.6.0/lib -I /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/quantile-0.2.0/lib
nil
Exception `ArgumentError' at /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:86 - wrong number of arguments (given 2, expected 1)
Exception `ArgumentError' at /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:49 - wrong number of arguments (given 2, expected 1)
Exception `ArgumentError' at /home/sven/.rbenv/versions/2.3.3/bin/rackup:22 - wrong number of arguments (given 2, expected 1)
/home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/deflater.rb:20:in `initialize': wrong number of arguments (given 2, expected 1) (ArgumentError)
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:86:in `new'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:86:in `block in use'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:134:in `block in to_app'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:134:in `each'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:134:in `inject'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:134:in `to_app'
from /home/sven/StarPerfMonitor_v2.0.0/config.ru:13:in `<main>'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:49:in `eval'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:49:in `new_from_string'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:40:in `parse_file'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:199:in `app'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:314:in `wrapped_app'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:242:in `start'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:141:in `start'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/bin/rackup:4:in `<top (required)>'
from /home/sven/.rbenv/versions/2.3.3/bin/rackup:22:in `load'
from /home/sven/.rbenv/versions/2.3.3/bin/rackup:22:in `<main>'
It seems you are using client_ruby 0.6.0 whereas Prometheus::Middleware is available only for client_ruby 0.7.0.
Check https://github.com/prometheus/client_ruby/tree/v0.6.0
This issue was too tricky, and I decided to switch over to InfluxDB.
And I was able to run the Ruby Client within minutes. It seems to be much more better for me, than Prometheus. Sorry.

Ruby/Cucumber - 'puts' causing trouble

We have recently installed a copy of our framework on another machine, and for some reason we get an error when using 'puts' instead of 'Kernel.puts' (we use Ruby)
This isn't a huge issue, but we occasionally use 'puts' to write to the cucumber results file.
This onlyhappens on 1 machine, not the other. Both are mac minis, same specs.
Both machines have the same gemlist, the same version of Ruby etc (they were both installed almost simultaneously).
Anyone else seen this?
Log:
2015-06-30 14:44:59 +0100 OUT: Error: undefined method <<' for nil:NilClass 2015-06-30 14:44:59 +0100 OUT: /Library/Ruby/Gems/2.0.0/gems/gherkin-2.12.2/lib/gherkin/formatter/json_formatter.rb:89:inwrite'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/formatter/gherkin_formatter_adapter.rb:166:in puts' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/tree_walker.rb:181:inblock in send_to_all'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/tree_walker.rb:179:in each' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/tree_walker.rb:179:insend_to_all'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/tree_walker.rb:173:in broadcast' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/tree_walker.rb:154:inputs'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/user_interface.rb:14:in puts' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/rb_support/rb_world.rb:107:inputs'
/Users/jenkins/workspace/TEST-regression-test_trial_mini/automation/ios/features/support/hooks.rb:104:in block in <top (required)>' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/core_ext/instance_exec.rb:48:ininstance_exec'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/core_ext/instance_exec.rb:48:in block in cucumber_instance_exec' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/core_ext/instance_exec.rb:69:incucumber_run_with_backtrace_filtering'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/core_ext/instance_exec.rb:36:in cucumber_instance_exec' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/rb_support/rb_hook.rb:14:ininvoke'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/language_support/language_methods.rb:114:in invoke' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/language_support/language_methods.rb:102:inblock in execute_before'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/language_support/language_methods.rb:101:in each' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/language_support/language_methods.rb:101:inexecute_before'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/language_support/language_methods.rb:15:in before' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:112:inblock in fire_hook'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:111:in each' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:111:infire_hook'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:107:in before' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:98:inbefore_and_after'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:82:in block in with_hooks' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:120:incall'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:120:in block (3 levels) in around' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/language_support/language_methods.rb:9:inblock in around'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/language_support/language_methods.rb:97:in call' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/language_support/language_methods.rb:97:inexecute_around'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/language_support/language_methods.rb:8:in around' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:119:inblock (2 levels) in around'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:123:in call' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:123:inaround'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:94:in around' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:81:inwith_hooks'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/tree_walker.rb:13:in execute' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/scenario.rb:32:inblock in accept'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/scenario.rb:79:in with_visitor' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/scenario.rb:31:inaccept'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/tree_walker.rb:58:in block in visit_feature_element' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/tree_walker.rb:170:inbroadcast'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/tree_walker.rb:57:in visit_feature_element' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/feature.rb:38:inblock in accept'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/feature.rb:37:in each' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/feature.rb:37:inaccept'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/tree_walker.rb:27:in block in visit_feature' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/tree_walker.rb:170:inbroadcast'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/tree_walker.rb:26:in visit_feature' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/features.rb:28:inblock in accept'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/features.rb:17:in each' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/features.rb:17:ineach'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/features.rb:27:in accept' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/tree_walker.rb:21:inblock in visit_features'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/tree_walker.rb:170:in broadcast' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/ast/tree_walker.rb:20:invisit_features'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:49:in run!' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/cli/main.rb:47:inexecute!'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/bin/cucumber:13:in <top (required)>' /usr/bin/cucumber:23:inload'
/usr/bin/cucumber:23:in
Something somewhere is overriding your puts. You'll just have to find it. As an alternative, use warn. From Avdi Grimm's Exceptional Ruby:
puts leaves something to be desired as a failure reporting method, however. Because its output goes to $stdout, which is buffered by default, output may not be printed immediately, or it may come out in a surprising order
warn is more succinct, while still using $stderr as its output stream. Note also that the output of warn can be temporarily silenced by passing the -W0 flag to Ruby.

capistrano deploy error - newbie

I'm new to ruby and currently having issues deploying with capistrano. below the errors I am getting.
cap aborted!
Operation timed out - connect(2)
/Users/stefydu/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/transport/session.rb:67:in `initialize'
/Users/stefydu/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/transport/session.rb:67:in `open'
/Users/stefydu/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/transport/session.rb:67:in `block in initialize'
/Users/stefydu/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/transport/session.rb:67:in `initialize'
/Users/stefydu/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh.rb:200:in `new'
/Users/stefydu/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh.rb:200:in `start'
/Users/stefydu/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:156:in `ssh'
/Users/stefydu/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:109:in `block in _execute'
/Users/stefydu/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:106:in `tap'
/Users/stefydu/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:106:in `_execute'
/Users/stefydu/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:54:in `execute'
/Users/stefydu/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/abstract.rb:75:in `within'
/Users/stefydu/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.0/lib/capistrano/tasks/git.rake:44:in `block (3 levels) in <top (required)>'
/Users/stefydu/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:42:in `instance_exec'
/Users/stefydu/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:42:in `run'
/Users/stefydu/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => git:create_release => git:update
(See full trace by running task with --trace)
Not a solution, but an explanation with workaround:
Capistrano 3, and with it sshkit, doesn't reuse existing SSH connections, but start a new one for every task (see https://github.com/capistrano/sshkit/issues/34).
Some servers, respectively their firewalls, seem to block new connection requests if they come to fast or if there are too many open connections.
Solutions:
Fix SSHKit/Capistrano to reuse connections
Configure your server/firewall to allow tons of parallel ssh sessions (for a simple rails app about 15)
use my hack below (Disclaimer: no, don't use it):
We're going to extend (monkeypatch) the execute method in gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb. That can be done via the Capfile:
# Overwrite execute method to avoid timeouts
class SSHKit::Backend::Netssh
def execute(*args)
_execute(*args).success?
rescue Errno::ETIMEDOUT
#tries ||= 0
raise "Nope, no way" if #tries > 5
puts "Timeout. yeah. Try it again (#{#tries})"
sleep 5
#tries += 1
execute(*args)
end
end
This gives the server a chance to breathe...
Capistrano uses a connection pool for SSH now:
https://github.com/capistrano/sshkit/pull/70

irb --noprompt error with autoindent on

I like using the --noprompt option on irb sometimes, especially when I may want to copy code from it and paste it somewhere else. However, an error occurs when the following appears in the .irbrc file:
IRB.conf[:AUTO_INDENT] = true
The following error occurs when irb starts up:
/Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb.rb:280:in `dup': can't dup NilClass (TypeError)
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb.rb:280:in `prompt'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb.rb:129:in `block in eval_input'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/ruby-lex.rb:206:in `call'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/ruby-lex.rb:206:in `prompt'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/ruby-lex.rb:220:in `initialize_input'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/ruby-lex.rb:227:in `each_top_level_statement'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb.rb:155:in `eval_input'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb.rb:70:in `block in start'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb.rb:69:in `catch'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb.rb:69:in `start'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/bin/irb:16:in `<main>'
The error also occurs in JRuby, but the stack trace is of course a bit different.
This is a bug, right? One would think an inappropriate configuration setting would be handled more gracefully, at minimum reporting the nature of the error at a higher level so the user would have an idea how to resolve it. Or could it be argued that it's the developer's fault for specifying an indent on a nonexistent prompt?
-- Keith
This is not a bug.
If you would like to have a .irbrc file ignored for special cases (such as when you want --noprompt) then you are likely also wanting to supply the -f flag to suppress loading your .irbrc file.
You will correctly get problems when supplying contradicting options.
TLDR;
irb -f --noprompt

Resources