On Wed, May 9, 2012 at 11:06 AM, Thomas Mortagne
<thomas.mortagne(a)xwiki.com> wrote:
On Tue, May 8, 2012 at 7:12 PM, Marius Dumitru
Florea
<mariusdumitru.florea(a)xwiki.com> wrote:
> Hi Fabio and devs,
>
> I found a serious concurrency issue in the REST server module while
> debugging the instability of the Extension Manager when
>
extensions.xwiki.org repository is used (default case) . The Extension
> Manager UI searches extensions using REST and very often it gets 500
> HTTP response code. See
http://jira.xwiki.org/browse/XWIKI-7773 for
> instance. The server log from
xwiki.org shows that the real cause is:
>
> May 8, 2012 5:09:14 PM org.restlet.engine.application.StatusFilter doHandle
> WARNING: Exception or error caught in status service
> java.util.ConcurrentModificationException
> at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
> at java.util.AbstractList$Itr.next(AbstractList.java:343)
> at
org.xwiki.rest.XWikiSetupCleanupFilter.afterHandle(XWikiSetupCleanupFilter.java:73)
>
> See the full stacktrace
http://pastebin.com/hnFSuwem .
>
> The problem is related to the way "releasable components" are managed.
> I debugged locally both XWikiSetupCleanupFilter [1] and
> ComponentsObjectFactory and here's what I discovered:
>
> * org.restlet.Context.getCurrent() is shared across HTTP requests
What I don't understand is that the Context is stored in a ThreadLocal
(see org.restlet.Context) so I don't see how it can be shared across
HTTP requests. Or maybe it's reused by two consecutive requests ?
Actually it could be that Restlet put the same context in all the
request using Context#setCurrent().