Bug 50293 - javax.el.CompositeELResolver synchronization issue
Summary: javax.el.CompositeELResolver synchronization issue
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Servlet & JSP API (show other bugs)
Version: trunk
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
: 52580 (view as bug list)
Depends on:
Reported: 2010-11-18 16:58 UTC by Robert Goff
Modified: 2012-02-05 19:18 UTC (History)
1 user (show)

Synchronize change in CompositeELResolver.add (1.34 KB, application/octet-stream)
2010-11-18 16:58 UTC, Robert Goff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Goff 2010-11-18 16:58:18 UTC
Created attachment 26310 [details]
Synchronize change in CompositeELResolver.add

The javax.el.CompositeELResolver.add method needs to synchronize around the update to the resolvers.  If two threads call add, then it is possible for both threads get past the size check, then one thread updates the size, and when the next thread tries to update the size, it fails with an ArrayIndexOutOfBoundsException.

Also, it makes sense to increase the default size of the ELResolver array since even the jasper EL adds 5 ELResolvers.  I propose a default of 8.
Comment 1 Mark Thomas 2010-11-19 13:32:24 UTC
The EL spec states the ELContexts are not thread-safe. By extension, neither are ELResolvers.

The point regarding increasing the default size is a valid one. I have increased it to 8 for 7.0.5 onwards as per your suggestion.
Comment 2 Mark Thomas 2012-02-05 19:18:05 UTC
*** Bug 52580 has been marked as a duplicate of this bug. ***