You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2007/08/28 14:34:14 UTC

DO NOT REPLY [Bug 43228] New: - StandardWrapper#countAllocated isn't thread-safe

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43228>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43228

           Summary: StandardWrapper#countAllocated isn't thread-safe
           Product: Tomcat 6
           Version: 6.0.14
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: kanekotky@gmail.com


Hi,

I noticed that StandardWrapper#countAllocated isn't thread-safe.
So, StandardWrapper#unload cannot finish until nRetries will be 21(40 seconds)
because countAllocated won't be 0.

I made a patch.

Regards,

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43228] - StandardWrapper#countAllocated isn't thread-safe

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43228>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43228





------- Additional Comments From kanekotky@gmail.com  2007-08-28 05:48 -------
> (40 seconds)

I'm sorry. It takes 2 seconds per Wrapper.
If Tomcat has 100-Wrappers and their countAllocated are incorrect, it takes 200
seconds to shutdown them.

Regards,

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43228] - StandardWrapper#countAllocated isn't thread-safe

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43228>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43228





------- Additional Comments From remm@apache.org  2007-08-30 16:17 -------
Yes, HelloWorldExample does a number of expensive operations.

OTOH, the shutdown strategy is not optimal at all, and has a lot of ways to go
wrong. It should use the time where the connectors (or the webapp) were
shutdown, rather that an individual per servlet time.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43228] - StandardWrapper#countAllocated isn't thread-safe

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43228>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43228





------- Additional Comments From kanekotky@gmail.com  2007-08-29 22:09 -------
Created an attachment (id=20738)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20738&action=view)
benchmark results with a simpler servlet

Hi Remy,

Did you mean that a significant overhead of HelloExampleServlet is
ResourceBundle.getBundle() or concatenating strings?

Anyway I did tests with a simpler Servlet.

testname, rps, 99% tile, cpu
original, 6777.25 [#/sec], 75 [ms], 86.90 [%]
patch,	  6873.97 [#/sec], 60 [ms], 86.29 [%]

And I did same tests with Keep-Alive.

testname, rps, 99% tile, cpu 
original, 10137.90 [#/sec], 60 [ms], 97.32 [%]
patch,	  10130.51 [#/sec], 63 [ms], 96.46 [%]

As a result, I could not see the overhead of using AtomicInteger on Tomcat.

However, this issue is not so serious problem because countAllocated is not
used on other places and we have already gotten a workalound, so I consent this
issue is WONTFIX.

I will never reopen it. :-) thanks a lot.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43228] - StandardWrapper#countAllocated isn't thread-safe

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43228>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43228





------- Additional Comments From kanekotky@gmail.com  2007-08-29 05:25 -------
Created an attachment (id=20726)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20726&action=view)
patch for document if needed


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43228] - StandardWrapper#countAllocated isn't thread-safe

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43228>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43228





------- Additional Comments From kanekotky@gmail.com  2007-08-28 05:35 -------
Created an attachment (id=20720)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20720&action=view)
patch against tc6.0.x


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43228] - StandardWrapper#countAllocated isn't thread-safe

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43228>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43228


remm@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX




------- Additional Comments From remm@apache.org  2007-08-28 06:03 -------
As usual, I am not in favor of applying this sort of patch, given the possible
high synchronization vs the actual severity of the issue. Feel free to continue
using your patch if it works for you.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43228] - StandardWrapper#countAllocated isn't thread-safe

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43228>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43228


remm@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |WONTFIX




------- Additional Comments From remm@apache.org  2007-08-29 07:15 -------
The HelloWorldExample has a significant overhead, unfortunately. As I said
previously, I don't think this patch is needed, sorry, especially since few
people see this as an issue. Please do not reopen the report, thanks.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43228] - StandardWrapper#countAllocated isn't thread-safe

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43228>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43228


kanekotky@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |




------- Additional Comments From kanekotky@gmail.com  2007-08-29 05:22 -------
Hi Remy,
thanks for response.

I have respects for your carefulness about the performance.

IMO, AtomicInteger doesn't have synchronization problem and it's overhead is
really low.
I did performance benchmarks using Apache Bench between original and my patch .

Here are the summary of results.

Requests per second:
original  5743.66 [#/sec] (mean)
patch     5748.83 [#/sec] (mean)

99% Percentage of the requests served within a certain time (ms)
original  96
patch     80

Average CPU Usage
original 96.35%
patch    96.25%

Is this reasonable? How do you think? 

BTW, the actual severity is that we cannot shutdown Tomcat quickly.
We can avoid this problem to set the StandardContext#unloadDelay as 0.
If this issue is WONTFIX, please note it on document instead.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43228] - StandardWrapper#countAllocated isn't thread-safe

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43228>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43228





------- Additional Comments From kanekotky@gmail.com  2007-08-29 05:23 -------
Created an attachment (id=20725)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20725&action=view)
benchmark results


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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