I'm using Tomcat 6.0, JDK 1.6 for a web app.

It's dying frequently requiring manual reboots, and the log file shows this:

Notice: Maximum number of threads (200) created for connector with address null and port 80

Followed by this:

Notice: Waiting for 200 instance(s) to be deallocated

Followed by 200 lines of this:

Severe: The web application [] is still processing a request that has yet to finish. This is very likely to create a memory leak. You can control the time allowed for requests to finish by using the unloadDelay attribute of the standard Context implementation.

Followed by 200 lines of this:

Severe: The web application [] created a ThreadLocal with key of type [net.sourceforge.jtds.jdbc.DateTime$1] (value [net.sourceforge.jtds.jdbc.DateTime$1@1d51620]) and a value of type [java.util.GregorianCalendar] (value [java.util.GregorianCalendar[time=1304607600000,areFieldsSet=true,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Asia/Seoul",offset=32400000,dstSavings=0,useDaylight=false,transitions=14,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2011,MONTH=4,WEEK_OF_YEAR=19,WEEK_OF_MONTH=1,DAY_OF_MONTH=6,DAY_OF_YEAR=126,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=32400000,DST_OFFSET=0]]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.

I see this as the GregorianCalendar is leaking, and isn't being gc'ed as usual.

The site does quite often create GregorianCalendar instances, adds a few months or years, formats the resulting Date, and prints the value to the user. However, I would expect that the GregorianCalendar instance is marked for collection as soon as the servlet finishes its request handling method.

What's going on?


It is probably not a memory leak... Your Connector Thread Pool is of size 200 (default) and all 200 connections are in use, this shows you have 200 request that are not terminated... The rest of the logs are because you stop Tomcat with those 200 pending requests... So the question is why are your requests not responding ? You may make a threaddump to see where the requests are blocked...

  • Am I to believe that all 200 connections were actually fine? Why do I get about the same number of "Severe" messages about GregorianCalendar objects? Shouldn't I expect a lot more, of varying types, if it's merely a case of stopping a server in the middle of its job? – bdares Dec 13 '11 at 9:50
  • The messages are about Threadlocals, which are variable bound to threads. Usually those are created by a filter at the beginning of a request and cleaned by the filter at the end, and as you never reach the end of the request you have this message... You still have to find out why your requests are not terminating... The 200 thing is just that you see problem only once then pool is exhausted... – pgras Dec 13 '11 at 20:40
  • Is this controlled by tomcat threadpool settings ? – Krithika Vittal Jan 2 '18 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.