bernerdschaefer / akephalos

Headless HTMLUnit powered browser for Capybara
bernerdschaefer.github.com/akephalos
MIT License
336 stars 50 forks source link

java.lang.OutOfMemoryError #71

Open patrickhno opened 13 years ago

patrickhno commented 13 years ago

Suddenly cucumber stopped working, and there really isn't any good way to debug into the java stuff. It fails on the very first step (Given I am on ...) I takes forever before it barfs.

You will see versions in the stack trace. We would very much like to use akephalos so if there is anything we could tweek right away feel free to come with sugestions. We have allready invested into rewriting our framework to use the akephalos and it's just mind blowing it suddenly stopped working. But I guess that's how it is with memory and heaps. Once the threshold is passed, nothing works.

@sok @wip Scenario: Search up a central and verify router information # features/sok/lsok_2e/central_port_info.feature:24 Given I am on the Sentralsøk page # features/step_definitions/web_steps.rb:19 "http://pathan.new.lsd/sok/lsok_1.php" java.lang.OutOfMemoryError: Java heap space (NativeException) (druby://127.0.0.1:53365) org/jruby/RubyKernel.java:2063:in send' (druby://127.0.0.1:53365) org/jruby/RubyKernel.java:1419:inloop' (druby://127.0.0.1:53365) org/jruby/RubyProc.java:268:in call' (druby://127.0.0.1:53365) org/jruby/RubyProc.java:232:incall' ./features/step_definitions/web_steps.rb:20:in /^(?:|I )am on (.+)$/' features/sok/lsok_2e/central_port_info.feature:25:inGiven I am on the Sentralsøk page' And I search for a central # features/step_definitions/page_object_steps.rb:327 Then DEBUG I should see a central # features/step_definitions/page_object_steps.rb:49 Given I follow Router on the central # features/step_definitions/page_object_steps.rb:188 Then I should see "Sentral utstyr" # features/step_definitions/web_steps.rb:107 java.lang.OutOfMemoryError: Java heap space (NativeException) (druby://127.0.0.1:53365) /home/pathan/.rvm/gems/ruby-1.9.2-p180/gems/akephalos-0.2.5/lib/akephalos/client.rb:107:in page' (druby://127.0.0.1:53365) org/jruby/RubyKernel.java:2059:insend' (druby://127.0.0.1:53365) file:/home/pathan/.rvm/gems/ruby-1.9.2-p180/gems/jruby-jars-1.6.2/lib/jruby-stdlib-1.6.2.jar!/META-INF/jruby.home/lib/ruby/1.8/drb/drb.rb:1593:in perform_without_block' (druby://127.0.0.1:53365) file:/home/pathan/.rvm/gems/ruby-1.9.2-p180/gems/jruby-jars-1.6.2/lib/jruby-stdlib-1.6.2.jar!/META-INF/jruby.home/lib/ruby/1.8/drb/drb.rb:1553:inperform' (druby://127.0.0.1:53365) file:/home/pathan/.rvm/gems/ruby-1.9.2-p180/gems/jruby-jars-1.6.2/lib/jruby-stdlib-1.6.2.jar!/META-INF/jruby.home/lib/ruby/1.8/drb/drb.rb:1627:in main_loop' (druby://127.0.0.1:53365) org/jruby/RubyKernel.java:1419:inloop' (druby://127.0.0.1:53365) file:/home/pathan/.rvm/gems/ruby-1.9.2-p180/gems/jruby-jars-1.6.2/lib/jruby-stdlib-1.6.2.jar!/META-INF/jruby.home/lib/ruby/1.8/drb/drb.rb:1623:in main_loop' (druby://127.0.0.1:53365) org/jruby/RubyProc.java:268:incall' (druby://127.0.0.1:53365) org/jruby/RubyProc.java:232:in call' /home/pathan/.rvm/gems/ruby-1.9.2-p180/gems/akephalos-0.2.5/lib/akephalos/capybara.rb:291:inpage' /home/pathan/.rvm/gems/ruby-1.9.2-p180/gems/akephalos-0.2.5/lib/akephalos/capybara.rb:217:in body' /home/pathan/.rvm/gems/ruby-1.9.2-p180/gems/capybara-0.4.1.2/lib/capybara/session.rb:89:inbody' /home/pathan/www/lsd/tests/cucumber/features/support/ventelo.rb:10:in `After' Exception in thread "RubyThread-6: file:/home/pathan/.rvm/gems/ruby-1.9.2-p180/gems/jruby-jars-1.6.2/lib/jruby-stdlib-1.6.2.jar!/META-INF/jruby.home/lib/ruby/1.8/drb/drb.rb:1619" java.lang.NullPointerException at org.jruby.javasupport.JavaClass.installClassFields(JavaClass.java:834) at org.jruby.javasupport.JavaClass.setupProxy(JavaClass.java:701) at org.jruby.javasupport.Java.createProxyClass(Java.java:524) at org.jruby.javasupport.Java.getProxyClass(Java.java:453) at org.jruby.javasupport.Java.getInstance(Java.java:362) at org.jruby.javasupport.JavaUtil.convertJavaToUsableRubyObject(JavaUtil.java:165) at org.jruby.javasupport.util.RuntimeHelpers.checkJavaException(RuntimeHelpers.java:1029) at org.jruby.javasupport.util.RuntimeHelpers.isJavaExceptionHandled(RuntimeHelpers.java:1053) at org.jruby.ast.RescueNode.handleJavaException(RescueNode.java:197) at org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:141) at org.jruby.ast.RescueNode.interpret(RescueNode.java:110) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96) at org.jruby.ast.BeginNode.interpret(BeginNode.java:83) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112) at org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:374) at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:295) at org.jruby.runtime.InterpretedBlock.yieldSpecific(InterpretedBlock.java:229) at org.jruby.runtime.Block.yieldSpecific(Block.java:99) at org.jruby.RubyKernel.loop(RubyKernel.java:1419) at org.jruby.RubyKernel$s$0$0$loop.call(RubyKernel$s$0$0$loop.gen:65535) at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:112) at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:123) at org.jruby.ast.FCallNoArgBlockNode.interpret(FCallNoArgBlockNode.java:32) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112) at org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:374) at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:328) at org.jruby.runtime.BlockBody.call(BlockBody.java:73) at org.jruby.runtime.Block.call(Block.java:89) at org.jruby.RubyProc.call(RubyProc.java:268) at org.jruby.RubyProc.call(RubyProc.java:232) at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:95) at java.lang.Thread.run(Thread.java:636)

patrickhno commented 13 years ago

I changed -Xmx128M to -Xms512 and it resolved the issue for me. Id be happy to commit if I knew how to attach code to this issue :-)

java_args = [
  "-Xmx512M",
  "-cp", [JRubyJars.core_jar_path, JRubyJars.stdlib_jar_path].join(":"),
  "org.jruby.Main"
]
Nerian commented 13 years ago

You can use this fork https://github.com/Nerian/akephalos. It gives more memory to the JVM.

patrickhno commented 13 years ago

Java is so perfect.. Should'nt this really be a option? I hardcoded the changes myself for now.

Nerian commented 13 years ago

That's is a nice idea. I will look at the code this afternoon.

Nerian commented 13 years ago

@patrickhno

I gave it a try and cooked this.

https://github.com/Nerian/akephalos/tree/jvm

Akephalos' tests pass but I haven't a full app using akephalos to try this. Does it work in your app?:

Gemfile.

gem 'akephalos', :git=>'git://github.com/Nerian/akephalos.git', :branch => 'jvm'

spec_helper.

Capybara.register_driver :akephalos do |app| 
  Capybara::Driver::Akephalos.new(app, :jvm_max_memory => '512')
end