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 2014/06/21 04:19:53 UTC
[Bug 56653] New: Concurrency issue with Mapper$ContextList when
stopping Contexts
https://issues.apache.org/bugzilla/show_bug.cgi?id=56653
Bug ID: 56653
Summary: Concurrency issue with Mapper$ContextList when
stopping Contexts
Product: Tomcat 8
Version: 8.0.8
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
Assignee: dev@tomcat.apache.org
Reporter: knst.kolinko@gmail.com
I noticed this issue while reviewing the code of Mapper.removeContextVersion()
of the current trunk (@1604217). The same code exists in Tomcat 7 and 6.
In Mapper.removeContextVersion() (Mapper.removeContext() in Tomcat 6) it does
the following:
[[[
host.contextList.contexts = newContexts;
// Recalculate nesting
host.contextList.nesting = 0;
for (int i = 0; i < newContexts.length; i++) {
int slashCount = slashCount(newContexts[i].name);
if (slashCount > host.contextList.nesting) {
host.contextList.nesting = slashCount;
}
}
]]]
The problem is there is a delay between when the list of contexts is updated
(contextList.contexts) and the contextList.nesting field is updated. The
"nesting" field is used when mapping contexts.
For example,
1. If there are the following contexts:
ROOT
foo
foo#bar
2. Context foo#bar is being stopped.
3. A request for "foo" comes in, e.g. http://localhost/foo/index.html
Expected behaviour: Map the context to foo application.
Actual behaviour:
It may be that the request will be erroneously mapped to the ROOT webapp
instead of "foo".
I have a test case.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 56653] Concurrency issue with Mapper$ContextList when stopping
Contexts
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56653
Konstantin Kolinko <kn...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS| |All
--- Comment #1 from Konstantin Kolinko <kn...@gmail.com> ---
I added the test case in r1604309.
It may pass, but I also observed the following failures:
org.junit.ComparisonFailure: expected:<[/foo/bar/bla]> but was:<[]>
at
org.apache.catalina.mapper.TestMapper.testContextListConcurrencyBug56653(TestMapper.java:263)
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 56653] Concurrency issue with Mapper$ContextList when stopping
Contexts
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56653
--- Comment #4 from Konstantin Kolinko <kn...@gmail.com> ---
(In reply to Konstantin Kolinko from comment #3)
> Fixed in Tomcat 8 by r1604319 and will be in 8.0.10 onwards.
A part of that solution was reverted in r1604934 and re-implemented in a
different way in r1604940.
Instead of introducing an additional level of indirection, I run a loop to
update all the aliases.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 56653] Concurrency issue with Mapper$ContextList when stopping
Contexts
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56653
Konstantin Kolinko <kn...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #31736|0 |1
is obsolete| |
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 56653] Concurrency issue with Mapper$ContextList when stopping
Contexts
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56653
Konstantin Kolinko <kn...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|Catalina |Catalina
Version|8.0.8 |7.0.54
Product|Tomcat 8 |Tomcat 7
Target Milestone|---- |---
--- Comment #3 from Konstantin Kolinko <kn...@gmail.com> ---
Fixed in Tomcat 8 by r1604319 and will be in 8.0.10 onwards.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 56653] Concurrency issue with Mapper$ContextList when stopping
Contexts
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56653
Konstantin Kolinko <kn...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|Catalina |Catalina
Version|7.0.54 |6.0.41
Product|Tomcat 7 |Tomcat 6
Target Milestone|--- |default
--- Comment #5 from Konstantin Kolinko <kn...@gmail.com> ---
Fixed in Tomcat 7 with r1608983 and r1608993 and will be in 7.0.55 onwards.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 56653] Concurrency issue with Mapper$ContextList when stopping
Contexts
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56653
--- Comment #2 from Konstantin Kolinko <kn...@gmail.com> ---
Created attachment 31736
--> https://issues.apache.org/bugzilla/attachment.cgi?id=31736&action=edit
2014-06-21_tc8_56653_v1.patch
This patch fixes the issue, BUT breaks aliases support.
Thanks to TestMapper tests for catching that.
The idea to turn ContextList into an immutable object with final fields does
not work, because all aliases share the same ContextList object.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org