Bug 34541 - hang on shutdown - countAllocated not synchronized
Summary: hang on shutdown - countAllocated not synchronized
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 4
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 4.0.6 Final
Hardware: Sun Solaris
: P1 major (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-20 15:29 UTC by Joe Cortopassi
Modified: 2005-04-27 15:23 UTC (History)
0 users



Attachments
Thread dump of hung Tomcat (5.46 KB, text/plain)
2005-04-20 15:30 UTC, Joe Cortopassi
Details
localhost_log (4.27 KB, text/plain)
2005-04-20 15:31 UTC, Joe Cortopassi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Cortopassi 2005-04-20 15:29:09 UTC
This may be a problem in Tomcat 5.X too. We are seeing hangs during shutdown of 
Tomcat. The localhost_log shows a last line of "2005-04-20 06:03:06 
StandardWrapper[/TomcatHang:hangServlet]: Waiting for 2 instance(s) to be 
deallocated". A thread dump shows the main thread waiting at "at 
org.apache.catalina.core.StandardWrapper.unload(StandardWrapper.java:1074)". 
There are no HTTP processor threads running - they have all shutdown. 
Inspecting the code shows unload waiting for the variable countAllocated to go 
to zero. However, the code that increments and decrements countAllocated for 
non-single-threaded servlets is not synchronized, so the value will not be 
correct in some cases. To test this I added synchronized blocks to the 
increment/decrement code and no longer get hangs.
Comment 1 Joe Cortopassi 2005-04-20 15:30:39 UTC
Created attachment 14769 [details]
Thread dump of hung Tomcat
Comment 2 Joe Cortopassi 2005-04-20 15:31:49 UTC
Created attachment 14770 [details]
localhost_log
Comment 3 Mark Thomas 2005-04-27 23:23:19 UTC
This was fixed almost 3 years ago in 4.1.5 or later.