• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat memory leak (Mac OS X)?

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
catalina.out:
...
Aug 31, 2010 12:28:39 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Aug 31, 2010 12:28:40 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [Poller SunPKCS11-Darwin] but has failed to stop it. This is very likely to create a memory leak.
Aug 31, 2010 12:28:40 PM org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080

It says SEVERE but is this really something I should be worried about?
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, it's an indication of sloppy application programming, but nobody gets worried about that these days.
 
Donald Winston
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not by me. There's nothing I'm doing that would cause this. It's difficult to create a "memory leak" in Java.
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Donald Winston wrote:Not by me. There's nothing I'm doing that would cause this. It's difficult to create a "memory leak" in Java.



I wish. I spent an entire month tracking down a memory leak several years back. Turned out an Oracle "cache" class was no such thing. By my definition at least, a cache includes an aging mechanism that limits how much data it contains. This particular "cache" was in fact a bottomless pit. Until the JVM ran out of memory about 4 days into a run.

More recently (yesterday!), I got a call for help from an old colleague because something in their webapp is leaking memory.

Occasionally, people even pay me to find that sort of stuff. Or they just schedule nightly reboots.
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to your log files, you are trying to shutdown Tomcat itself, and that particular thread did not shutdown in the time frame that Tomcat thought was reasonable given that it was shutting itself down.

If this were your own application, I would try to use the admin panel to remove that application from a Tomcat instance that is still running - see if the message occurs then. If it does, then you have a problem with your own application leaving threads running (which will cause both a memory leak and reduce the number of threads in the pool).

I think that particular thread is one that comes with Tomcat, and is used for cryptographic key storage. As such, it is not meant to be taken in/out of service. So the fact that it failed to shut down instantly the moment that Tomcat asked it to shut down is not necessarily a problem. In fact it may even be desirable: if there is some other application relying on PKCS11 that has not yet started to shutdown, and all of a sudden the service disappears, it is going to have some major error handling to do (or continue without encryption - eek).
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It doesn't come with Tomcat, although with a name like that, it might come with the MacOS JVM.

I'm extremely sceptical, however, that it's "OK" for a thread to be tripping an alert like that. If it's a JVM thread, it should be getting its shutdown message only after Tomcat has terminated all the webapps and flushed out all the outstanding requests. Which would make it very unlikely that you'd get a Tomcat error that said "A web application appears to have started a thread " from the WebappClassLoader clearReferencesThreads method.

According to a stack dump someone posted over on one of Apple's support forums, this is a daemon thread. Since it's not part of Tomcat (or at least part of Tomcat 6), and all the messages are claiming it belongs to a webapp, that implies that the webapp didn't terminate the thread properly before the webapp itself indicated that it was done shutting down. This doesn't look like the type of process that should take long to terminate under normal conditions, so chances are that the offending webapp didn't try to terminate the thread at all.

I wouldn't worry too much about memory leaks here, unless the thread is saving up large encryption buffers for a rainy day or something.
 
Put the moon back where you found it! We need it for tides and poetry and stuff. Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic