Hi Pid, et al:
Things are curiouser and curiouser. I decided to deploy the struts blank app after starting
tomcat with startup.sh.
Well there is no memory leak after undeploy and redeploy. If I start tomcat with jsvc, I
get a memory leak.
This is the minimal init script I used to start the tomcat daemon.
snip..
# Source function library.
. /etc/init.d/functions
# Adapt the following lines to your configuration
JAVA_HOME=/usr/java/jdk1.6.0_18
CATALINA_HOME=/home/vir6.0.26/apache-tomcat-6.0.26
DAEMON_HOME=$CATALINA_HOME/bin
TOMCAT_USER=mas
#CATALINA_OPTS="-Djava.awt.headless=true "
#LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_HOME/conf/logging.properties"
#JAVA_OPTS="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
CLASSPATH=\
$JAVA_HOME/lib/tools.jar:\
$CATALINA_HOME/bin/commons-daemon.jar:\
$CATALINA_HOME/bin/bootstrap.jar
start(){
$DAEMON_HOME/jsvc \
-jvm server \
-user $TOMCAT_USER \
-home $JAVA_HOME \
-Dcatalina.base=$CATALINA_HOME \
-Dcatalina.home=$CATALINA_HOME \
-Djava.io.tmpdir=$CATALINA_HOME/temp \
-outfile $CATALINA_HOME/logs/catalina.out \
-errfile '&1' \
-cp $CLASSPATH \
org.apache.catalina.startup.Bootstrap
echo "starting: " $CATALINA_HOME
echo "tomcat user: " $TOMCAT_USER
#
# To get a verbose JVM
#-verbose \
# To get a debug of jsvc.
#-debug \
}
stop(){
# killproc jsvc
# PID=`cat /var/run/jsvc.pid`
# kill $PID
$DAEMON_HOME/jsvc \
-stop \
-pidfile /var/run/jsvc.pid \
org.apache.catalina.startup.Bootstrap
echo "stopping tomcat: " $CATALINA_HOME
echo "tomcat user: " $TOMCAT_USER
}
case "$1" in
start)
#
# Start Tomcat
#
start
;;
status)
status jsvc
;;
stop)
#
# Stop Tomcat
#
stop
;;
restart)
stop
start
;;
*)
echo "Usage tomcat6.0.26 start/stop/restart/status"
exit 1;;
esac
When I load the heap dump and do a classloaderexplorerquery using MAT I get this:
Class Name | Defined Classes | No.
of Instances
----------------------------------------------------------------------------------------------------------
org.apache.catalina.loader.WebappClassLoader @ 0x94977290 | 260 |
186
|- parent org.apache.catalina.loader.StandardClassLoader @ 0x94861d10| 935 |
3,750
|- org.apache.commons.beanutils.converters.ConverterFacade | |
54
|- org.apache.commons.logging.impl.Jdk14Logger | |
38
|- org.apache.commons.beanutils.converters.ArrayConverter | |
27
|- org.apache.commons.beanutils.WeakFastHashMap | |
4
|- org.apache.commons.beanutils.converters.BooleanConverter | |
4
|- org.apache.commons.beanutils.converters.ByteConverter | |
4
|- org.apache.commons.beanutils.converters.CharacterConverter | |
4
|- org.apache.commons.beanutils.converters.DoubleConverter | |
4
|- org.apache.commons.beanutils.converters.FloatConverter | |
4
|- org.apache.commons.beanutils.converters.IntegerConverter | |
4
|- org.apache.commons.beanutils.converters.LongConverter | |
4
|- org.apache.commons.beanutils.converters.ShortConverter | |
4
|- org.apache.commons.beanutils.converters.DateConverter | |
3
|- org.apache.commons.beanutils.converters.BigDecimalConverter | |
2
|- org.apache.commons.beanutils.converters.BigIntegerConverter | |
2
|- org.apache.commons.beanutils.converters.ClassConverter | |
2
|- org.apache.commons.beanutils.converters.FileConverter | |
2
|- org.apache.commons.beanutils.converters.SqlDateConverter | |
2
|- org.apache.commons.beanutils.converters.SqlTimeConverter | |
2
|- org.apache.commons.beanutils.converters.SqlTimestampConverter | |
2
|- org.apache.commons.beanutils.converters.StringConverter | |
2
|- org.apache.commons.beanutils.converters.URLConverter | |
2
|- org.apache.commons.beanutils.BeanUtilsBean | |
1
|- org.apache.commons.beanutils.BeanUtilsBean$1 | |
1
----------------------------------------------------------------------------------------------------------
If in undeploy and redeploy the struts blank app and do a duplicate classes query I get this:
Class Name | Count | Defined Classes | No.
of Instances
--------------------------------------------------------------------------------------------------------
org.apache.catalina.loader.JdbcLeakPrevention | 2 | |
|- org.apache.catalina.loader.WebappClassLoader @ 0x948b5c38| | 260 |
186
|- org.apache.catalina.loader.WebappClassLoader @ 0x94958320| | 260 |
186
'- Total: 2 entries | | |
org.apache.commons.beanutils.BeanAccessLanguageException | 2 | |
org.apache.commons.beanutils.BeanUtils | 2 | |
org.apache.commons.beanutils.BeanUtilsBean | 2 | |
org.apache.commons.beanutils.BeanUtilsBean$1 | 2 | |
org.apache.commons.beanutils.ContextClassLoaderLocal | 2 | |
org.apache.commons.beanutils.ConversionException | 2 | |
org.apache.commons.beanutils.ConvertUtils | 2 | |
org.apache.commons.beanutils.ConvertUtilsBean | 2 | |
org.apache.commons.beanutils.Converter | 2 | |
org.apache.commons.beanutils.DynaBean | 2 | |
org.apache.commons.beanutils.DynaClass | 2 | |
org.apache.commons.beanutils.DynaProperty | 2 | |
org.apache.commons.beanutils.MappedPropertyDescriptor | 2 | |
Total: 14 of 260 entries | 520 | |
--------------------------------------------------------------------------------------------------------
The struts 1.3.10 blank webapp is found here http://www.alliedquotes.com/mirrors/apache/struts/examples/struts-1.3.10-apps.zip
It is just a shell without much of anything except a welcome page.
I am now worried that I have done something wrong with jsvc (which is why I included my startup
script). I added
-Djava.util.logging.config.file=$CATALINA_HOME/conf/logging.properties and
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager to the script after snooping
in catalina.sh.
This made juli logging work but didn't get rid of the leak.
Any ideas would be appreciated.
mas
On 05/15/2010 04:58 AM, Pid wrote:
> On 14/05/2010 19:21, Mark Shifman wrote:
>> After playing around I don't think the leak is from JAXBContext. My web app is running
under struts 1.3.10. I tested
>> the blank web apps that comes with struts 1.3.10 and it showed a memory leak on undeploying
and redeploying. (so did the
>> blank web app for the current struts 2). Using Eclipse MAT the retained WebappClassLoader
showed a bunch of commons.beanutils
>> classes but I am not sure how to follow it any farther.
>>
>> So either there is something funky with commons.beanutils 1.8.0 (also tried the newer
version)(ie something tricky with reflection or commons-logging)
>> or I have some how done something really stupid with my tomcat/jvm configuration
that goofs up garbage collection.
>
> Interesting. I had more of a nose around in JAXBContext and the
> peripheral objects and found some things I'm slightly curious about but
> nothing that looks leaky. I'm using JAXB myself and haven't seen much
> of a side-effect.
>
> I'd be happy to have a look at Struts if you'd like to detail some of
> what you've found. Maybe we'll find something that can be contributed
> to the Tomcat JreMemoryLeakPrevention.
>
>
> p
>
>
>> mas
>>
>> On 05/03/2010 12:15 PM, Mark Shifman wrote:
>>> I have a web app running under tomcat-6.0.26 with JreMemoryLeakPreventionListener,
java jdk1.6.0_18.
>>>
>>> Using jmap -histo pid, I can watch com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl,
etc increase in number
>>> after running my unmarshal action, followed by undeploy and redeploy. Find Leaks
in the manager also finds leaks.
>>>
>>> The JAXBContext instance is created with a singleton that is an enum (using Josh
Block's pattern):
>>>
>>> public enum JAXBContextMascot {
>>> INSTANCE("com.matrixscience.xmlns.schema.mascot_search_results_2" );
>>> private JAXBContext ctx;
>>> JAXBContextMascot(String contextPath) {
>>> try {
>>> ctx =JAXBContext.newInstance(clazz);
>>> } catch (JAXBException e) {
>>> throw new RuntimeException(e);
>>> }
>>> }
>>> public Unmarshaller createUnmarshaller(){
>>> try {
>>> return ctx.createUnmarshaller();
>>> } catch (JAXBException e) {
>>> throw new RuntimeException(e);
>>> }
>>> }
>>> }
>>>
>>> Am I doing something wrong which is causing the memory leak?
>>> JAXBContext.newInstance() can take a ClassLoader argument. Is there some ClassLoader
I should be using that will get around this?
>>>
>>> Any help would be appreciated.
>>> mas
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
mas
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
|