0

Error related to stackoverflow after deployment

asked 2009-04-30 00:45:50 +0800

judacoor gravatar image judacoor
280 1 3 8

Hello,

I developed my application and now I am trying to deploy it on a server with Cent OS and Tomcat 5.5 using MySQL 5 as well.

The application works perfectly on my development computer, but now that I have put it online some pages are starting to fail.

My application has a set of borderlayouts to divide the pages with a menu, and while navigating through the menu the application works just fine, and loads all the elements of each menu perfectly.

But when it tries to load some pages within the borderlayout after accessing the different menus, these pages cannot be loaded and it shows the following error:

Failed to load /BIZ/pac/PacSearch.zul

Cause: Unknown exception: java.lang.StackOverflowError.
java.lang.StackOverflowError
	at org.zkoss.lang.Objects.hashCode(Objects.java:216)
	at org.zkoss.util.Pair.hashCode(Pair.java:60)
	at java.util.HashMap.getEntry(HashMap.java:344)
	at java.util.LinkedHashMap.get(LinkedHashMap.java:280)
	at org.zkoss.util.CacheMap.getWithoutExpunge(CacheMap.java:374)
	at org.zkoss.util.CacheMap.get(CacheMap.java:368)
	at org.zkoss.util.ThreadLocalCache.get(ThreadLocalCache.java:67)
	at org.zkoss.zk.ui.sys.ComponentsCtrl.getEventMethod(ComponentsCtrl.java:325)
...

At first I thought it was because the server was short of memory (it had only 8MB free!!) but now I have stopped some services that were not used and it currently shows 207MB of available memory, and I have also set the Heap settings to Tomcat to

initial heap: 64MB
max heap: 150MB

But the pages still fail to load.

Could anyone please help me identify the source of the problem and a possible solution?

Please, I need to put the application up and running as soon as possible and I ignore what else to do!

Thank you

judacoor

delete flag offensive retag edit

8 Replies

Sort by ยป oldest newest

answered 2009-04-30 03:40:19 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

the message said - short of stack ..
you should enlarge the thread size, search "enlarge stack size java" in google.

link publish delete flag offensive edit

answered 2009-04-30 22:43:12 +0800

judacoor gravatar image judacoor
280 1 3 8

updated 2009-05-02 17:41:32 +0800

Hi dennis,

I have googled your suggestion but have not been able to solve the problem.

Would you happen to know the commands I should use to check how much memory is been allocated to the stack? And how to upgrade that size?

So far I have tried:


-ss Stacksize to increase the native stack size or
-oss Stacksize to increase the Java stack size,

where Stacksize is expressed as an integer followed by "k" or "m" for kbytes or mbytes. For example,

$java -ss156k (native)
$java -oss600k (Java)

The default native stack size is 128k, with a minimum value of 1000 bytes. The default java stack size is 400k, with a minimum value of 1000 bytes.

But I executed the commands in the console in the following way:

java -ss1024k
java -oss1024k

But nothing happened, and I am still getting the stackOverFlowError :S


I would I appreciate your help very much,

link publish delete flag offensive edit

answered 2009-05-01 20:58:45 +0800

judacoor gravatar image judacoor
280 1 3 8

updated 2009-05-02 17:41:45 +0800

Hello everyone,

I have been dealing with this problem for so long now, please somebody help me...

1. I have changed the heap settings
2. The stack size for java
3. The stack size for apache

But I am still getting the stackOverFlow error, could it be the application? But the thing is that the application works perfectly fine on my development computer...

The server is running on Cent OS, with 288MB of RAM.

Thank you,

link publish delete flag offensive edit

answered 2009-05-02 12:25:51 +0800

mjablonski gravatar image mjablonski
1284 3 5
http://www.jease.org/

You'll have to set the stackSize via an environemnt variable (CATALINA_OPTS or JAVA_OPTS), so Tomcat picks it up when it is started.

Execute in your shell something like:

export CATALINA_OPTS="-Xss1024k"

Then start Tomcat.

Personal note: I would recommend to buy some more RAM... 288MB will be sooner or later a showstopper anyway...

link publish delete flag offensive edit

answered 2009-05-02 15:57:28 +0800

judacoor gravatar image judacoor
280 1 3 8

mjablonski,

Thank you for your support. I have done the following through my console:

export CATALINA_OPTS="-Xms100m -Xmx200m"
export CATALINA_OPTS="-Xss4096k"

And then I restarted tomcat. But I am still getting the following error:


Failed to load /BIZ/pac/PacSearch.zul

Cause: Unknown exception: java.lang.StackOverflowError.
java.lang.StackOverflowError
at org.zkoss.lang.Exceptions.getMessage(Exceptions.java:348)
at org.zkoss.zk.ui.metainfo.Property.assign(Property.java:177)
at org.zkoss.zk.ui.metainfo.ComponentInfo.applyProperties(ComponentInfo.java:769)
at org.zkoss.zk.ui.impl.AbstractUiFactory.newComponent(AbstractUiFactory.java:95)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:600)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:583)


The zul page has the "use" property to link it to a java class with the Model-View-Controller 'style' and on the afterCompose() method/service/function I use:

Components.addForwards(this, this);
Components.wireVariables(this, this);

To link everything up with java. The java class has 278 lines of code and 11 services/methods and I don't know if this would maybe be too much load for tomcat, the server or something...

I am just still getting the same error and I am going crazy with it, for as I posted earlier, in my development computer (1.86GHz double core, 2GB RAM, everything standard, neither the JVM nor tomcat have tunning) the application runs very good with no errors whatsoever!

Would you please care to give me further support?

Thank you

link publish delete flag offensive edit

answered 2009-05-02 17:57:45 +0800

mjablonski gravatar image mjablonski
1284 3 5
http://www.jease.org/

Please try:

export CATALINA_OPTS="-Xms100m -Xmx200m -Xss4096k"

Otherwise the second export would overwrite the first one, so the heap-size was still unchanged (and I suspect the heap as the causing problem).

Cheers, Maik

link publish delete flag offensive edit

answered 2009-05-02 18:49:40 +0800

judacoor gravatar image judacoor
280 1 3 8

Maik,

I have now modified the tomcat.conf file to get all the settings up when I restart tomcat, to:

#********************************************************************
# Wrapper Properties
#********************************************************************
# Java Application
set.JAVA_HOME=/usr/java/j2sdk
wrapper.java.command=%JAVA_HOME%/bin/java

set.TOMCAT_HOME=/opt/tomcat5
set.TOMCAT_LOG=/var/log/tomcat5

# Use new ticker
wrapper.use_system_time=FALSE

# Java Main class.  This class must implement the WrapperListener interface
#  or guarantee that the WrapperManager class is initialized.  Helper
#  classes are provided to do this for you.  See the Integration section
#  of the documentation for details.
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperStartStopApp

# Java Classpath (include wrapper.jar)  Add class path elements as
#  needed starting from 1
wrapper.java.classpath.1=%TOMCAT_HOME%/common/lib/wrapper.jar
wrapper.java.classpath.2=%JAVA_HOME%/lib/tools.jar
wrapper.java.classpath.3=%TOMCAT_HOME%/bin/bootstrap.jar
wrapper.java.classpath.4=%TOMCAT_HOME%/bin/commons-logging-api.jar

# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=%TOMCAT_HOME%/common/lib

# Java Additional Parameters
wrapper.java.additional.1=-server
wrapper.java.additional.2=-Djava.endorsed.dirs=%TOMCAT_HOME%/common/endorsed
wrapper.java.additional.3=-Dcatalina.base=%TOMCAT_HOME%
wrapper.java.additional.4=-Dcatalina.home=%TOMCAT_HOME%
wrapper.java.additional.5=-Djava.io.tmpdir=%TOMCAT_HOME%/temp
wrapper.java.additional.6=-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false 


# Initial Java Heap Size (in MB)
wrapper.java.initmemory=150

# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=220

# Java Stack Size
wrapper.java.additional.7=-Djava -Xss8096k

#StackSize via environmental variable
export JAVA_OPTS="-Xms150m -Xmx220m -Xss8096k -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
export CATALINA_OPTS="-Xms150m -Xmx220m -Xss8096k"

# Application parameters.  Add parameters as needed starting from 1

# The first application parameter is the name of the class whose main
# method is to be called when the application is launched.  The class
# name is followed by the number of parameters to be passed to its main
# method.  Then comes the actual parameters.
wrapper.app.parameter.1=org.apache.catalina.startup.Bootstrap
wrapper.app.parameter.2=1
wrapper.app.parameter.3=start

# The start parameters are followed by the name of the class whose main
# method is to be called to stop the application.  The stop class name
# is followed by a flag which controls whether or not the Wrapper should
# wait for all non daemon threads to complete before exiting the JVM.
# The flag is followed by the number of parameters to be passed to the
# stop class's main method.  Finally comes the actual parameters.
wrapper.app.parameter.4=org.apache.catalina.startup.Bootstrap
wrapper.app.parameter.5=true
wrapper.app.parameter.6=1
wrapper.app.parameter.7=stop

#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Format of output for the console.  (See docs for formats)
wrapper.console.format=PM

# Log Level for console output.  (See docs for log levels)
wrapper.console.loglevel=INFO

# Log file to use for wrapper output logging.
wrapper.logfile=%TOMCAT_LOG%/catalina.out

# Format of output for the log file.  (See docs for formats)
wrapper.logfile.format=LPTM

# Log Level for log file output.  (See docs for log levels)
wrapper.logfile.loglevel=INFO

# Maximum size that the log file will be allowed to grow to before
#  the log is rolled. Size is specified in bytes.  The default value
#  of 0, disables log rolling.  May abbreviate with the 'k' (kb) or
#  'm' (mb) suffix.  For example: 10m = 10 megabytes.
wrapper.logfile.maxsize=0

# Maximum number of rolled log files which will be allowed before old
#  files are deleted.  The default value of 0 implies no limit.
wrapper.logfile.maxfiles=0

# Log Level for sys/event log output.  (See docs for log levels)
wrapper.syslog.loglevel=NONE

#********************************************************************
# Wrapper NT Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
#  using this configuration file has been installed as a service.
#  Please uninstall the service before modifying this section.  The
#  service can then be reinstalled.

# Name of the service
[email protected]@

# Display name of the service
[email protected]@

# Description of the service
[email protected]@

# Service dependencies.  Add dependencies as needed starting from 1
wrapper.ntservice.dependency.1=

# Mode in which the service is installed.  AUTO_START or DEMAND_START
wrapper.ntservice.starttype=AUTO_START

# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false

But I am still getting the stackOverFlow error. And it is quite intriguing because I tried setting my tomcat manager to the following option on my development computer:

Initial memory pool: 20MB
Maximum memory pool: 20MB
Thread stack size: 512KB

Which I think is considerably low compared to what the tomcat.conf file configures in the server...and guess what......the application STILL RUNS PERFECTLY ON THE DEVELOPMENT COMPUTER!!!
So now I am even more lost than before, because after setting those variables as low as that on the dev computer, the application still runs fine.....


Would it be necessary to upgrade the plan on the server so I can get better CPU performance and RAM?

Do you think a possible solution would be to uninstall tomcat, java and reinstall again?


Could you please help me a little more?

link publish delete flag offensive edit

answered 2009-05-04 19:50:31 +0800

judacoor gravatar image judacoor
280 1 3 8

To whom it may interest,

I have solved the problem, it was actually a very dumb thing, but almost made me kill myself this past week!!

After looking a little deeper into the log files, and reading a little about MySQL in Cent OS and Windows OS, I have determined the source of the problem:

In Linux MySQL is case sensitive, and 2 of the stored procedures used in the application had a table name written with its first letter in uppercase, resulting in an unresolved call to a SP; and when the application eventually ran out of memory, it returned the mentioned error.

I have solved it now, by adjusting the case in each sp.

Thank you so much to your kind support.

mjablonski and dennis, special thanks to you for your effort in providing me with possible solutions to my problem.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-04-30 00:45:50 +0800

Seen: 250 times

Last updated: May 04 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More