users@glassfish.java.net

Re: GF3-1 Non GUI Installation and JVM option

From: Tom Mueller <tom.mueller_at_oracle.com>
Date: Fri, 08 Apr 2011 10:06:19 -0500

Hi,
You might find this page to be interesting:
http://objectmix.com/java/158302-linux-java-lang-outofmemoryerror-unable-create-new-native-thread.html

Summary, it turns out that increasing the Xmx size does reduce the space
available for threads (sorry about that).
Also, check "ulimit -a" to see what your limits are on maximum memory size.

Tom


On 4/8/2011 9:43 AM, Florent THOMAS wrote:
> Hy Tom,
>
> Thanks for considering my email.
> I checked the free memory of my VPS : 1,8Go. Only a few proc run on it.
>
> So I consider to use your asadmin command.
> Unfortunately it's worse. Increasing the heap size seems to cause
> problems :
>
> /.Error starting domain domain1.
> The server exited prematurely with exit code 1.
> Before it died, it produced the following output:
>
> Launching GlassFish on Felix platform
> ERROR: Unable to start system bundle. (java.lang.OutOfMemoryError:
> unable to create new native thread)
> Java HotSpot(TM) 64-Bit Server VM warning: Attempt to allocate stack
> guard pages failed.
> Java HotSpot(TM) 64-Bit Server VM warning: Attempt to allocate stack
> guard pages failed.
> java.lang.OutOfMemoryError: unable to create new native thread
> at java.lang.Thread.start0(Native Method)
> at java.lang.Thread.start(Thread.java:640)
> at
> org.apache.felix.framework.StartLevelImpl.<init>(StartLevelImpl.java:47)
> at
> org.apache.felix.framework.StartLevelActivator.start(StartLevelActivator.java:38)
>
> at
> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:629)
>
> at
> org.apache.felix.framework.Felix$SystemBundleActivator.start(Felix.java:4316)
>
> at org.apache.felix.framework.util.Secur
> /
> As I read in a few post, couldn't it be the stack that has to be
> modified? If yes, in which proportions?
>
> Regards
>
> Le 08/04/2011 16:16, Tom Mueller a écrit :
>> First, check to see if you have enough memory on the system. Since
>> you are running with 2GB, it is possible that with many other
>> processes on the system and not enough swap space, you could be
>> running out of memory at the system level. To do this, run the "top"
>> program. At the top of the display is the amount of memory and swap
>> and you can see how much is in use. To run GlassFish, you need to
>> have about 1GB free. If there isn't that much free, then you need to
>> add additional swap space.
>>
>> If there is enough system memory, you can increase the amount of
>> memory available to GlassFish with the following command:
>>
>> asadmin --echo delete-jvm-options -Xmx512m
>> asadmin --echo create-jvm-options -Xmx800m (or whatever number you want)
>>
>> Tom
>>
>>
>> On 4/8/2011 4:59 AM, Florent THOMAS wrote:
>>> Hy all of you,
>>>
>>> I used the .zip and extract it in the appropriate folder that suits
>>> to me.
>>> I'm running on a old XL VPS hosted by 1and1 with 2Go for RAM and x86_64
>>> I've properly configured the java installation :
>>>
>>> /java -version
>>> java version "1.6.0_24"
>>> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
>>> Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
>>> /
>>> The $JAVA_HOME is well defined as well :
>>>
>>> /echo $JAVA_HOME
>>> /usr/java/jdk1.6.0_24/
>>>
>>> As I run the asadmin start-domain domain1 everything to be ok as the
>>> prompt said everythings OK.
>>> Moreover the loclahost:8080 answers and the log as no errors.
>>> Unfortunately, as I try to access to the admin console via
>>> localhost:4848, I have some memory problems :
>>>
>>> /[#|2011-04-08T11:54:55.494+0200|SEVERE|glassfish3.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=88;_ThreadName=Thread-1;|Exception
>>> in thread "Thread-42" |#]
>>>
>>> [#|2011-04-08T11:54:55.507+0200|SEVERE|glassfish3.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=88;_ThreadName=Thread-1;|java.lang.OutOfMemoryError:
>>> unable to create new native thread
>>> at java.lang.Thread.start0(Native Method)
>>> at java.lang.Thread.start(Thread.java:640)
>>> at
>>> java.util.concurrent.ThreadPoolExecutor.addIfUnderMaximumPoolSize(ThreadPoolExecutor.java:727)
>>> at
>>> java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:657)
>>> at
>>> java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:78)
>>> at
>>> org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:117)
>>> at
>>> org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:81)
>>> at
>>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:247)
>>> at
>>> com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:364)
>>> at
>>> com.sun.enterprise.v3.admin.adapter.InstallerThread.load(InstallerThread.java:210)
>>> at
>>> com.sun.enterprise.v3.admin.adapter.InstallerThread.run(InstallerThread.java:108)
>>> |#]
>>>
>>> [#|2011-04-08T11:54:57.073+0200|INFO|glassfish3.1|com.sun.jersey.server.impl.application.WebApplicationImpl|_ThreadID=22;_ThreadName=Thread-1;|Initiating
>>> Jersey application, version 'Jersey: 1.5 01/14/2011 12:36 PM'|#]
>>> /
>>> I found this :
>>> http://candrews.integralblue.com/2009/01/preventing-outofmemoryerror-native-thread/
>>> (I made some unsuccesfull tests using this post)
>>> and that :
>>> http://candrews.integralblue.com/2009/01/preventing-outofmemoryerror-native-thread/
>>>
>>> But as a french reader and almost a linux newbie I'm a little lost
>>> in what I can do to let my admin console launch.
>>>
>>> Thanks for your help
>>>
>>> Regards