You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ian Long <ia...@opterus.com> on 2009/03/12 18:21:00 UTC

Garbage collection problem and Tomcat

Hey All,

I'm having an issue where a connection pool (apache dbcp) is waiting  
forever for a connection, when I see no reason for it to do so.   
Nothing else has the lock, as I did a stack dump of the stuck  
threads.  I googled the problem and found a few other people who had  
the issue, and there problem was related to GC.

 From the kill -quit of the tomcat process, I see the following:

INFO   | jvm 1    | 2009/03/12 11:52:58 | Heap
INFO   | jvm 1    | 2009/03/12 11:52:58 |  PSYoungGen      total  
207616K, used 45724K [0xa6a60000, 0xb4de0000, 0xb4de0000)
INFO   | jvm 1    | 2009/03/12 11:52:58 |   eden space 198784K, 18%  
used [0xa6a60000,0xa8e676f0,0xb2c80000)
INFO   | jvm 1    | 2009/03/12 11:52:58 |   from space 8832K, 99% used  
[0xb4540000,0xb4ddfae8,0xb4de0000)
INFO   | jvm 1    | 2009/03/12 11:52:58 |   to   space 17088K, 0% used  
[0xb2c80000,0xb2c80000,0xb3d30000)
INFO   | jvm 1    | 2009/03/12 11:52:58 |  PSOldGen        total  
1864192K, used 623335K [0x34de0000, 0xa6a60000, 0xa6a60000)
INFO   | jvm 1    | 2009/03/12 11:52:58 |   object space 1864192K, 33%  
used [0x34de0000,0x5ae99da0,0xa6a60000)
INFO   | jvm 1    | 2009/03/12 11:52:58 |  PSPermGen       total  
77056K, used 76996K [0x1cde0000, 0x21920000, 0x34de0000)
INFO   | jvm 1    | 2009/03/12 11:52:58 |   object space 77056K, 99%  
used [0x1cde0000,0x21911028,0x21920000)
INFO   | jvm 1    | 2009/03/12 11:52:58 |

I see the 'from space' is at 99% used, as is PSPermGen object space.

My memory parameters for tomcat are:

wrapper.java.additional.5=-XX:MaxPermSize=384m
wrapper.java.initmemory=2048
wrapper.java.maxmemory=2048

Do you think this could be causing my problem?  I am using cacti to  
graph tomcat heap, but it doesn't show any problems.

Cheers,
Ian Long
Chief Software Architect, Opterus Inc.

Email: ian.long@opterus.com
Phone: 416-840-8495 x666
Mobile: 416-817-9206
Web: http://www.opterus.com





Re: Garbage collection problem and Tomcat

Posted by Gabor Kincses <be...@gmail.com>.
I like your answer.  Gentlemanness returned.  Opinion reverted.

Gabor
P.S. I get crabby when vital information is missing in bug reports as much
as the next guy.  I should have resisted instead of wasting people's time.

On Thu, Mar 12, 2009 at 11:12 AM, Caldarale, Charles R <
Chuck.Caldarale@unisys.com> wrote:

> > From: Gabor Kincses [mailto:berkert2@gmail.com]
> > Subject: Re: Garbage collection problem and Tomcat
> >
> > I like your attitude.  Your bile is spilling out.  The word
> > *please* is not in your repertoire.  Nice.
>
> You're right, I could have been kinder in my response.  I'm always annoyed
> when the poster doesn't bother to include basic information such as Tomcat
> version, JRE/JDK being used, and platform.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you received
> this in error, please contact the sender and delete the e-mail and its
> attachments from all computers.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

RE: Garbage collection problem and Tomcat

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Gabor Kincses [mailto:berkert2@gmail.com] 
> Subject: Re: Garbage collection problem and Tomcat
> 
> I like your attitude.  Your bile is spilling out.  The word 
> *please* is not in your repertoire.  Nice.

You're right, I could have been kinder in my response.  I'm always annoyed when the poster doesn't bother to include basic information such as Tomcat version, JRE/JDK being used, and platform.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Garbage collection problem and Tomcat

Posted by Gabor Kincses <be...@gmail.com>.
I like your attitude.  Your bile is spilling out.  The word *please* is not
in your repertoire.  Nice.

Gabor
P.S. Sorry, I should have resisted.

On Thu, Mar 12, 2009 at 10:45 AM, Caldarale, Charles R <
Chuck.Caldarale@unisys.com> wrote:

> > From: Ian Long [mailto:ian.long@opterus.com]
> > Subject: Garbage collection problem and Tomcat
> >
> > I'm having an issue where a connection pool (apache dbcp) is waiting
> > forever for a connection, when I see no reason for it to do so.
>
> The usual cause is pool exhaustion, due to improper coding in a webapp that
> fails to return connections to the pool under *all* circumstances.
>
> > Nothing else has the lock
>
> Irrelevant.
>
> > I googled the problem and found a few other people who had
> > the issue, and there problem was related to GC.
>
> Highly unlikely; sounds like finger-pointing.
>
> > I see the 'from space' is at 99% used, as is PSPermGen object space.
>
> Not true in either case.  You've used up 99% of what was *allocated* for
> the particular space at this time, not 99% of the maximum.  You're nowhere
> close to filling up any region of the heap.
>
> > Do you think this could be causing my problem?
>
> No.
>
> If you had bothered to tell us the version of Tomcat you're using, we could
> have told you the proper documentation to read about how to use a connection
> pool.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you received
> this in error, please contact the sender and delete the e-mail and its
> attachments from all computers.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Garbage collection problem and Tomcat

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ian,

On 3/12/2009 2:03 PM, Ian Long wrote:
> I'm using hibernate wrapped via the spring framework, so all connections
> *should* be returned to the pool under all conditions.

Do you ever obtain a java.sql.Connection object in your own code? If so,
could you post a sample so we can see how you handle it? IF you never do
this, I would complain to the spring and/or hibernate folks.

> I don't use
> tomcat(6.0.16) connection pools, I have hibernate (via spring) to use
> the connection pool directly.

So Tomcat is not involved at all. You should post to their list instead
of here, since Tomcat is really just a bystander.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkm+yU0ACgkQ9CaO5/Lv0PD8zQCdFRtEbBsHRk5RDK6tDGZWKvWt
fRUAoJ7LJiWo7LizqzNdVGHGXN/SF0Uc
=sho1
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Garbage collection problem and Tomcat

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Ian Long [mailto:ian.long@opterus.com] 
> Subject: Re: Garbage collection problem and Tomcat
> 
> I'm using hibernate wrapped via the spring framework, 
> so all connections *should* be returned to the pool 
> under all conditions.

Then you might want to inquire on the Spring mailing list.  There is likely some tracing capability in whatever pooling mechanism you're using so you can find out who's not returning the connections.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Garbage collection problem and Tomcat

Posted by Ian Long <ia...@opterus.com>.
I'm using hibernate wrapped via the spring framework, so all  
connections *should* be returned to the pool under all conditions.  I  
don't use tomcat(6.0.16) connection pools, I have hibernate (via  
spring) to use the connection pool directly.

The pool is setup as follows:

jdbc.testOnBorrow=true
jdbc.validationQuery=select 1 + 1
jdbc.maxActive=100
jdbc.maxIdle=10
jdbc.minIdle=0
jdbc.timeBetweenEvictionRunsMillis=-1
jdbc.minEvictableIdleTimeMillis=900000
jdbc.maxWait=15000

These map directly to the dbcp settings.

Cheers,
Ian Long
Chief Software Architect, Opterus Inc.

Email: ian.long@opterus.com
Phone: 416-840-8495 x666
Mobile: 416-817-9206
Web: http://www.opterus.com




On 12-Mar-09, at 1:45 PM, Caldarale, Charles R wrote:

>> From: Ian Long [mailto:ian.long@opterus.com]
>> Subject: Garbage collection problem and Tomcat
>>
>> I'm having an issue where a connection pool (apache dbcp) is waiting
>> forever for a connection, when I see no reason for it to do so.
>
> The usual cause is pool exhaustion, due to improper coding in a  
> webapp that fails to return connections to the pool under *all*  
> circumstances.
>
>> Nothing else has the lock
>
> Irrelevant.
>
>> I googled the problem and found a few other people who had
>> the issue, and there problem was related to GC.
>
> Highly unlikely; sounds like finger-pointing.
>
>> I see the 'from space' is at 99% used, as is PSPermGen object space.
>
> Not true in either case.  You've used up 99% of what was *allocated*  
> for the particular space at this time, not 99% of the maximum.   
> You're nowhere close to filling up any region of the heap.
>
>> Do you think this could be causing my problem?
>
> No.
>
> If you had bothered to tell us the version of Tomcat you're using,  
> we could have told you the proper documentation to read about how to  
> use a connection pool.
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE  
> PROPRIETARY MATERIAL and is thus for use only by the intended  
> recipient. If you received this in error, please contact the sender  
> and delete the e-mail and its attachments from all computers.
>
> ---------------------------------------------------------------------
> 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


RE: Garbage collection problem and Tomcat

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Ian Long [mailto:ian.long@opterus.com] 
> Subject: Garbage collection problem and Tomcat
> 
> I'm having an issue where a connection pool (apache dbcp) is waiting  
> forever for a connection, when I see no reason for it to do so.   

The usual cause is pool exhaustion, due to improper coding in a webapp that fails to return connections to the pool under *all* circumstances.

> Nothing else has the lock

Irrelevant.

> I googled the problem and found a few other people who had  
> the issue, and there problem was related to GC.

Highly unlikely; sounds like finger-pointing.

> I see the 'from space' is at 99% used, as is PSPermGen object space.

Not true in either case.  You've used up 99% of what was *allocated* for the particular space at this time, not 99% of the maximum.  You're nowhere close to filling up any region of the heap.

> Do you think this could be causing my problem?

No.

If you had bothered to tell us the version of Tomcat you're using, we could have told you the proper documentation to read about how to use a connection pool.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org