This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 122593 - "java.lang.OutOfMemoryError: Java heap space " Exception while opening gem window
Summary: "java.lang.OutOfMemoryError: Java heap space " Exception while opening gem wi...
Status: VERIFIED FIXED
Alias: None
Product: ruby
Classification: Unclassified
Component: Gems (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Martin Krauskopf
URL:
Keywords:
: 124622 126538 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-11-22 16:25 UTC by sapanparikh18
Modified: 2008-03-06 16:18 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
a screenshot of the error (103.46 KB, image/png)
2007-11-22 16:25 UTC, sapanparikh18
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sapanparikh18 2007-11-22 16:25:14 UTC
Hi I am using NB 6.0 on OpenSuse10.3, It seems that this is purely a memmory management issue and files/list are 
getting read in memory instead of getting streamed. I have attached a screen shot for better understanding.
Comment 1 sapanparikh18 2007-11-22 16:25:57 UTC
Created attachment 53375 [details]
a screenshot of the error
Comment 2 sapanparikh18 2007-11-22 16:54:45 UTC
Adding the real stackTrace
pdating installed gems...
Bulk updating Gem source index for: http://gems.rubyforge.org
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at java.util.HashMap.<init>(HashMap.java:209)
	at org.jvyamlb.ResolverImpl.descendResolver(ResolverImpl.java:112)
	at org.jvyamlb.ComposerImpl.composeNode(ComposerImpl.java:124)
	at org.jvyamlb.ComposerImpl.composeNode(ComposerImpl.java:163)
	at org.jvyamlb.ComposerImpl.composeNode(ComposerImpl.java:167)
	at org.jvyamlb.ComposerImpl.composeNode(ComposerImpl.java:167)
	at org.jvyamlb.ComposerImpl.composeDocument(ComposerImpl.java:100)
	at org.jvyamlb.ComposerImpl.getNode(ComposerImpl.java:76)
	at org.jvyamlb.BaseConstructorImpl.getData(BaseConstructorImpl.java:97)
	at org.jruby.RubyYAML.load(RubyYAML.java:221)
	at org.jruby.RubyYAMLInvokerSload1.call(Unknown Source)
	at org.jruby.runtime.callback.FastInvocationCallback.execute(FastInvocationCallback.java:49)
	at org.jruby.internal.runtime.methods.SimpleCallbackMethod.call(SimpleCallbackMethod.java:81)
	at org.jruby.evaluator.EvaluationState.callNode(EvaluationState.java:571)
	at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:207)
	at org.jruby.evaluator.EvaluationState.orNode(EvaluationState.java:1461)
	at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:339)
	at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:164)
	at org.jruby.internal.runtime.methods.DefaultMethod.internalCall(DefaultMethod.java:142)
	at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:79)
	at org.jruby.evaluator.EvaluationState.fCallNode(EvaluationState.java:1025)
	at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:253)
	at org.jruby.evaluator.EvaluationState.blockNode(EvaluationState.java:533)
	at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:201)
	at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:164)
	at org.jruby.internal.runtime.methods.DefaultMethod.internalCall(DefaultMethod.java:142)
	at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:79)
	at org.jruby.evaluator.EvaluationState.fCallNode(EvaluationState.java:1025)
	at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:253)
	at org.jruby.evaluator.EvaluationState.localAsgnNode(EvaluationState.java:1236)
	at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:286)
	at org.jruby.evaluator.EvaluationState.blockNode(EvaluationState.java:533)
Comment 3 Martin Krauskopf 2007-11-22 17:18:50 UTC
Hi. Does it happen every time and which version of NetBeans are you using? Did you try to give more memory to your
NetBeans. It could help in the case, you really just need larger heap (a lot of files, huge project, etc.).
In the case of leak we will need more information. Stacktrace does not help here to find a leak. See.
http://wiki.netbeans.org/wiki/view/FaqNetBeansAndOOME.
So depending on the answers we can proceed further. Thanks for the feedback.
Comment 4 sapanparikh18 2007-11-23 18:49:31 UTC
It happens always and it is independent of what project I have opened. As you can see in the screen shot this is
happening when i am running GEM tool on NB 6.0 so if i go to tools and run GEM even if when no project is opened the
same thing happens. Moreover shouldn't it just work with default memory settings? This seems a very basic operation the
same thing is also happening when i goto new ruby project->update ruby.
Comment 5 Jiri Skrivanek 2007-11-23 20:33:09 UTC
There is probably a problem but I haven't faced it on any hardware configuration when I tried gems dialog. Memory
consumption goes up when you do the following:

- open Tools|Ruby Gems
- wait until gems are populated
- click 'Reload Gems' several times

sapanparikh18, please, could you use latest NetBeans 6.0 RC2 and attach messages.log? Thanks.
Comment 6 Petr Jiricka 2007-11-26 10:20:31 UTC
Also, how much memory do you have on your machine? Thanks.
Comment 7 sapanparikh18 2007-11-26 14:37:56 UTC
My machine has 1.2 GB of main memory and maybe 8-10 GB of Linux Swap memory. I think i wont use the NB RC2 right now as
NB 6.0 is just lined up and i will have to install it anyways in couple of days.
Comment 8 Torbjorn Norbye 2007-11-26 21:14:44 UTC
What happens if you run gem list --remote on the command line?  (with JRuby)

The "Ruby Gems" manager in NetBeans is simply a GUI shell on top of the command line gem tool - and as far as I can
tell, the separate JRuby process is running into Out Of Memory issues.

That should happen on the command line too.. does it? Have you set any environment variables that could affect JRuby,
such as JRUBY_EXTRA_VM_ARGS ?

If not, what happens if you set it to "-Xmx512m" and then restart the IDE?
Comment 9 sapanparikh18 2007-12-08 05:32:25 UTC
I have now NB 6.0 production version and same problem is appening. Cant't test it on command line as it just doesnt 
work on command line. Moreover I am not that great a linux user who can do much about it.
Comment 10 William Leonard 2007-12-09 10:39:11 UTC
Tor, this is a JRuby issue and I usually run into it as well. I'm not able to fix it using the JRUBY_EXTRA_VM_ARGS
variable, however, editing the _jrubyvmopts file in the jruby bin directory does solve the problem. /Brian
Comment 11 sapanparikh18 2007-12-09 16:56:39 UTC
What exactly do you change? I just changed "set _MEM=-Xmx378m" to "set _MEM=-Xmx640m" but the problem still persists.
Comment 12 William Leonard 2007-12-09 22:05:31 UTC
Yes, that's what I changed, however, I only bumped it up to 512. I would recommend you refile this issue on the
jruby.org web site. As the RubyGem repository is growing rapidly, they probably need a more efficient way of populating
their list. Doing a quick search, I did find these issues which are probably related:

http://jira.codehaus.org/browse/JRUBY-1085
http://jira.codehaus.org/browse/JRUBY-1437

/Brian
Comment 13 Martin Krauskopf 2007-12-13 05:47:13 UTC
sapanparikh18, could you try the same from the CLI? You might see what command is used when you turn on the logging:

  http://wiki.netbeans.org/wiki/view/FaqRubyNBLogging

Then you might either copy-paste the command into the command-line or you can run something like:

$ ./bin/jruby -S gem list --both

Which should be the same. Does it also throw OOME?
Comment 14 Martin Krauskopf 2007-12-13 13:42:55 UTC
No need to investigate further. I've just reproduced it as well. Exactly the same scenario. I've copy-pasted command and
run from command-line, getting exactly the same error. We are passing "-Xmx256m" which is not enough for gem listing.
I did not read Brian's comment carefully before.
I'll bump-up maximum heap space to 512m, which is what is done in JRuby scripts.
Comment 15 Martin Krauskopf 2007-12-16 15:58:11 UTC
Fixed.

Checking in RubyExecution.java;
new revision: 1.3; previous revision: 1.2
Comment 16 Martin Krauskopf 2008-01-03 14:02:37 UTC
*** Issue 124622 has been marked as a duplicate of this issue. ***
Comment 17 Martin Krauskopf 2008-01-07 12:45:46 UTC
Hi Peter, could you patch the 6.0 branch so users can take the update for 6.0 from UC to get rid of this bug? Not sure
how much has to be done, if there is some 'official' process. Pasting fix against the release60. Thanks.


Index: projects/src/org/netbeans/modules/ruby/rubyproject/api/RubyExecution.java
===================================================================
RCS file: /cvs/ruby/projects/src/org/netbeans/modules/ruby/rubyproject/api/Attic/RubyExecution.java,v
retrieving revision 1.18
diff -u -r1.18 RubyExecution.java
--- projects/src/org/netbeans/modules/ruby/rubyproject/api/RubyExecution.java	1 Nov 2007 15:01:23 -0000	1.18
+++ projects/src/org/netbeans/modules/ruby/rubyproject/api/RubyExecution.java	7 Jan 2008 12:42:26 -0000
@@ -169,7 +169,7 @@
             
             String extraArgs = System.getenv("JRUBY_EXTRA_VM_ARGS"); // NOI18N
 
-            String javaMemory = "-Xmx256m"; // NOI18N
+            String javaMemory = "-Xmx512m"; // NOI18N
             String javaStack = "-Xss1024k"; // NOI18N
             
             if (extraArgs != null) {

Comment 18 Martin Krauskopf 2008-01-07 12:47:14 UTC
PS: patch against $NB_SRC/ruby directory
Comment 19 Petr Blaha 2008-01-31 13:18:01 UTC
Verified in custom nbm provided by Martin.
Comment 20 Martin Krauskopf 2008-02-02 09:19:39 UTC
*** Issue 126538 has been marked as a duplicate of this issue. ***
Comment 21 pgebauer 2008-02-04 11:20:05 UTC
The fix has been ported into the release601_fixes branch.

Checking in RubyExecution.java;
/cvs/ruby/projects/src/org/netbeans/modules/ruby/rubyproject/api/Attic/RubyExecution.java,v  <--  RubyExecution.java
new revision: 1.18.6.1; previous revision: 1.18
done
Comment 22 Erno Mononen 2008-03-06 10:20:38 UTC
I still see this problem in 

Product Version: NetBeans IDE 6.0.1 (Build 200801291616)
Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19
System: Linux version 2.6.22-14-386 running on i386; UTF-8; en_US (nb)
Comment 23 pgebauer 2008-03-06 10:25:29 UTC
Have you applied all Ruby updates from Stable AUC?
Comment 24 Erno Mononen 2008-03-06 10:34:54 UTC
No, I just downloaded 6.0.1. So the fix is not in 6.0.1 itself?
Comment 25 pgebauer 2008-03-06 14:55:25 UTC
The fix is part of update for NetBeans IDE 6.0.1 .  The list of all updates for NetBeans IDE 6.0 and NetBeans IDE 6.0.1
can be found at http://wiki.netbeans.org/NetBeans6.0PatchesInfo . Since both IDEs share the same AUC there is the common
list of updates. All issues with release date after Jan/31/2008 (NetBeans IDE 6.0.1 release date) are updates for
NetBeans IDE 6.0.1 .
Comment 26 Erno Mononen 2008-03-06 16:18:20 UTC
Right, updating the Ruby and Rails module helped. Thanks.