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 188540 - Insufficient memory arguments specified at server startup, resulting in PermGen errors
Summary: Insufficient memory arguments specified at server startup, resulting in PermG...
Status: RESOLVED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: WebLogic (show other bugs)
Version: 6.x
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Denis Anisimov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-09 12:59 UTC by Petr Jiricka
Modified: 2010-08-17 03:18 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Jiricka 2010-07-09 12:59:26 UTC
The IDE starts the server with particular memory arguments. Namely, this is what I see in the server output:
JAVA Memory arguments: -Xms512m -Xmx512m -XX:MaxPermSize=128m

However, the README.txt document recommends higher memory arguments for Mac:
   Mac
    $ export USER_MEM_ARGS="-Xmx1024m -XX:PermSize=256m"
    $ . $MW_HOME/wlserver/server/bin/setWLSEnv.sh 

I am getting PermGen errors because of this discrepancy. The IDE should follow the recommendation from the README document and set the arguments accordingly.
Comment 1 Petr Hejl 2010-07-10 11:30:25 UTC
FYI IDE just invoke start script. It does not configure any additional parameters. Much better solution would be if Weblogic installation would set this up for startup script rather than just stating that in README.

I'll try to do something about that in the IDE. Disadvantage is that the IDE will have to tune the parameters with each possible change in WL (while WL installation script could do it quite easily).
Comment 2 Petr Jiricka 2010-07-12 07:57:59 UTC
Thanks. I agree that this should be handled on the WebLogic side and we should send this feedback to the WebLogic team, but right now, we need to work with what we have. Plus, the IDE needs to work with the already released versions of WebLogic.
Comment 3 Petr Jiricka 2010-07-29 12:30:50 UTC
Update: with the new Platform tab in the WebLogic properties, it is possible to specify memory arguments in the VM Options textfield. But there are still a couple problems:
1. When I specify desired memory arguments, these are *appended* to the command line, they do not *replace* the WebLogic defaults. I.e. the Java arguments like looks like this:

/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java -client   -Xms512m -Xmx512m -XX:MaxPermSize=128m -Dweblogic.Name=AdminServer -Djava.security.policy=/Users/petrjiricka/wls1034_dev2//wlserver/server/lib/weblogic.policy -Xmx1024m -XX:PermSize=256m  -da -Dplatform.home=/Users/petrjiricka/wls1034_dev2//wlserver -Dwls.home=/Users/petrjiricka/wls1034_dev2//wlserver/server -Dweblogic.home=/Users/petrjiricka/wls1034_dev2//wlserver/server   -Dweblogic.management.discover=true  -Dwlw.iterativeDev= -Dwlw.testConsole= -Dwlw.logErrorsToConsole=  weblogic.Server

2. Also, the server output displays:
JAVA Memory arguments: -Xms512m -Xmx512m -XX:MaxPermSize=128m
which does not correspond to the real arguments.

This is because WebLogic uses JAVA_OPTIONS and USER_MEM_ARGS environment variables, and we are only setting JAVA_OPTIONS. USER_MEM_ARGS is not specified, so WebLogic defaults are used.

3. Still the correct default platform-specific arguments are not pre-filled in WebLogic options.

The solution could be to add a new textfield for memory options, which would map to USER_MEM_ARGS. This textfield would be pre-filled with the right options per platform. Another solution would be to only have the VM Options field, and when constructing the process, split it into memory arguments (which would be mapped to USER_MEM_ARGS) and other arguments (which would be mapped to JAVA_OPTIONS). What do you think?
Comment 4 Petr Jiricka 2010-08-04 20:33:41 UTC
Also, it looks like the arguments are not used when starting the server in debug mode (and possibly also profiling).
Comment 5 Denis Anisimov 2010-08-11 12:30:04 UTC
I'll fix it.

I'm going to create additional textfield for JVM memory arguments in the 
customizer.

You are right about ignoring java options ( env variables ) for profiling and
debug. 
It was not done previously because such configuration could be
implemented in the separate "Debug" and "Profile" tabs.
But they are not implemented for now. So I will just include common options 
for debug and profile run task.
Comment 6 Denis Anisimov 2010-08-12 07:20:20 UTC
changeset:   175531:9458094add83
user:        Denis Anisimov <ads@netbeans.org>
date:        Thu Aug 12 11:18:02 2010 +0400
summary:     Fix for BZ#188540 -  Insufficient memory arguments specified at server startup, resulting in PermGen errors
Comment 7 Petr Jiricka 2010-08-12 11:32:01 UTC
Thanks, the UI looks good; the remaining part is to make sure that the VM Memory Options field is pre-filled with the correct defaults for the particular platform, i.e. specifically on the Mac:
-Xmx1024m -XX:PermSize=256m

So, reopening for this last piece.
Comment 8 Denis Anisimov 2010-08-12 12:00:59 UTC
Actually the last request is too risky to implement it at least for now.
This is minor enhancement which requires careful parsing startup script.
Such parsing is not bulletproof always .
There can be minor errors in parsing which could lead to fatal problem with 
server start.
The startup script could be changed with newer version.
It doesn't have format specification so no one can guarantee that 
parsing will be correctly done.

Please look at setDomainEnv.sh script which setting up the MEM_ARGS env variable
which could be set via USER_MEM_ARGS from scratch.
There is a big section which performs initialization of this variable.
Your suggestion is the same as realization part of shell runtime interpreter .
It is very non-trivial work for such minor enhancement. 

Anyway :
- this is not P2. I'm reducing it to P3
- this is enhancement .
And I'm pretty sure that current stabilization mode is bad time for 
implementing such functionality.
Comment 9 Quality Engineering 2010-08-13 03:08:49 UTC
Integrated into 'main-golden', will be available in build *201008130001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/9458094add83
User: Denis Anisimov <ads@netbeans.org>
Log: Fix for BZ#188540 -  Insufficient memory arguments specified at server startup, resulting in PermGen errors.
Comment 10 Petr Jiricka 2010-08-13 11:21:37 UTC
> This is minor enhancement

Not really. With incorrect memory arguments WebLogic regularly fails with OutOfMemoryError, even when deploying just small applications. So this is an important bug affecting Mac users.

> requires careful parsing startup script 

I would hope this is not necessary. Can we just have static information on the required memory arguments, per platform and WebLogic version? Then it would come down to a few ifs. We will have to maintain and update this information as new WebLogic versions are released, but this should not be too much work. As far as I know, we already have the knowledge of the version, don't we?
Comment 11 Denis Anisimov 2010-08-13 12:52:48 UTC
I understand your concern about Mac.
But fix for this issue will be applied for all platform .
Current behavior for other platform is good. But result of fix could
break it. So it really risky.

Actually after some thinking I think I found the way how to do this:
- One need to change current UI. Checkbox could be added to the panel. 
User could write to memory texfield his memory options if it unchecked .
Default value will be inserted into textfield and it will be non-editable if
checkbox is checked. This is "default" value which will be red from startup
set env script ( checkbox is "set default memory options" ).
- How to access to default memory options ( bulletproof ): run 
"setDomainEnv" script for access to memory options. There should be script
which print memory env variable which is set by "setDomainEnv". One just need
to read process output.

It is safest way to get such default variable value.
Comment 12 Petr Hejl 2010-08-13 13:25:27 UTC
I wouldn't complicate it that much.

I would suggest to prefill the recommended values for Mac. For other platforms there will be no prefilled value. In case we would need to differentiate WL versions we can certainly do that.

So the whole fix should be something like

if (Utilities.isMac()) {
  ip.setProperty(USER_MEM, "-Xmx1024m -XX:PermSize=256m");
}

somewhere in registration process. We will see if that is enough.
Comment 13 Petr Jiricka 2010-08-13 13:45:40 UTC
I agree - let's keep it simple.
Comment 14 Petr Hejl 2010-08-13 13:51:16 UTC
Fixed in web-main 27faf4c05354.
Comment 15 Quality Engineering 2010-08-17 03:18:18 UTC
Integrated into 'main-golden', will be available in build *201008170001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/27faf4c05354
User: Petr Hejl <phejl@netbeans.org>
Log: #188540 Insufficient memory arguments specified at server startup, resulting in PermGen errors