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 2015/10/22 21:54:03 UTC

[Bug 58522] New: concurrency problem corrupts WARDirContext.Entry children

https://bz.apache.org/bugzilla/show_bug.cgi?id=58522

            Bug ID: 58522
           Summary: concurrency problem corrupts WARDirContext.Entry
                    children
           Product: Tomcat 7
           Version: 7.0.52
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: ryan.fong@workday.com

We discovered a problem where calling ServletContext.getResourcePaths from a
jsp may corrupt WARDirContext.Entry.children. The WARDirContext.list(Entry)
method performs an Arrays.sort(children) call which is not thread-safe. Calling
this from multiple request threads may result in the children array losing some
entries and duplicating others.

When entries representing directories in the war are lost, Tomcat cannot load
resources from there. Static resource requests result in http error code 404
and jsp compliation can throw JasperException when included files are not
found.

We have seen this on CentOS 6.5 (and newer versions) with Tomcat 7.0.52 and
Java 1.7.0_51.

The following are attached in the zip:
* Test case project which demonstrates this corruption. It usually requires
multiple runs.
* A stack trace illustrating the problematic flow.
* A patch file for WARDirContext.java.

-- 
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 58522] concurrency problem corrupts WARDirContext.Entry children

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58522

Violeta Georgieva <vi...@apache.org> changed:

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

--- Comment #4 from Violeta Georgieva <vi...@apache.org> ---
Hi,

The fix is provided in 7.0.x trunk and will be available in 7.0.66 onwards.

Regards,
Violeta

-- 
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 58522] concurrency problem corrupts WARDirContext.Entry children

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58522

--- Comment #2 from Violeta Georgieva <vi...@apache.org> ---
Created attachment 33201
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33201&action=edit
Proposal

Hi,

Can you test the different approach that I have.

I also do not like the idea that the original array is returned but I didn't
tested the performance if I return a copy of the array.

Regards,
Violeta

-- 
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 58522] concurrency problem corrupts WARDirContext.Entry children

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58522

--- Comment #3 from Ryan Fong <ry...@workday.com> ---
G'day, Violeta. Your proposal looks great. In fact, it will likely improve
throughput since we only deploy the war once and your patch avoids unnecessary
sorting on all subsequent calls. Thank you!

-- 
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 58522] concurrency problem corrupts WARDirContext.Entry children

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58522

--- Comment #1 from Ryan Fong <ry...@workday.com> ---
Created attachment 33195
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33195&action=edit
everything

-- 
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