You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Allen Gilbert <al...@doane.edu> on 2012/03/01 17:33:29 UTC

Re: JavaSerializer - java.util.ConcurrentModificationException during page serialization

Martin,

I definitely did a bunch of googling before pinging the mailing list, and
also attempted to pinpoint the List throwing the CME.  Unfortunately, it
was not very easy, as a lot of Lists were being serialized with our pages.
 Anyway, I think I've finally tracked down the bug.  Its cause is related
to two issues:

1) A custom, widely-used behavior was holding on to a reference to our
custom Session object, causing the Session to be serialized every time a
page was serialized.
2) Our Session was not thread-safe, as we incorrectly assumed that the
framework took care of that for us.  One of the Lists it contains was the
one throwing the CME (probably due to a user opening multiple tabs for the
same session?)

We've fixed both issues, so we'll see how things go.  Obviously, this bug
was our own doing, but I do think it'd be helpful if the Javadoc for
Session and Application mentioned that their thread-safety is up to users.
 I found out in my copy of Wicket in Action :-).

Thanks!

On Wed, Feb 29, 2012 at 1:54 AM, Martin Grigorov <mg...@apache.org>wrote:

> Hi,
>
> On Wed, Feb 29, 2012 at 12:37 AM, Allen Gilbert <al...@doane.edu>
> wrote:
> > Hello,
> >
> > I'm trying to crack a strange, intermittent bug that's cropped up on our
> > production site.  We're using Wicket 1.5.4, and receive the following
> stack
> > trace a couple times a day under nominal load:
> >
> > 2012-02-23 14:24:57,051 ERROR [ajp-0.0.0.0-8009-2]
> > [org.apache.wicket.serialize.java.JavaSerializer] error writing object
> > [Page class = com.company.web.pages.account.MyAccount, id = 8, render
> count
> > = 2]: null
> > java.util.ConcurrentModificationException
> >        at java.util.ArrayList.writeObject(ArrayList.java:573)
> >        at sun.reflect.GeneratedMethodAccessor252.invoke(Unknown Source)
> >        at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >        at java.lang.reflect.Method.invoke(Method.java:597)
> >        at
> > java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
> >        at
> > java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
> >        ...
> >        at
> > java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
> >        at
> >
> org.apache.wicket.serialize.java.JavaSerializer$CheckerObjectOutputStream.writeObjectOverride(JavaSerializer.java:250)
> >        at
> > java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
> >        at
> >
> org.apache.wicket.serialize.java.JavaSerializer.serialize(JavaSerializer.java:77)
> >        at
> >
> org.apache.wicket.pageStore.DefaultPageStore.serializePage(DefaultPageStore.java:368)
> >        at
> >
> org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:146)
> >        at
> >
> org.apache.wicket.page.PageStoreManager$PersistentRequestAdapter.storeTouchedPages(PageStoreManager.java:383)
> >        at
> >
> org.apache.wicket.page.RequestAdapter.commitRequest(RequestAdapter.java:171)
> >        at
> >
> org.apache.wicket.page.AbstractPageManager.commitRequest(AbstractPageManager.java:94)
> >        at
> >
> org.apache.wicket.page.PageManagerDecorator.commitRequest(PageManagerDecorator.java:68)
> >        at
> >
> org.apache.wicket.page.PageAccessSynchronizer$2.commitRequest(PageAccessSynchronizer.java:281)
> >        at org.apache.wicket.Application$2.onDetach(Application.java:1598)
> >        at
> >
> org.apache.wicket.request.cycle.RequestCycleListenerCollection$3.notify(RequestCycleListenerCollection.java:99)
> >        at
> >
> org.apache.wicket.request.cycle.RequestCycleListenerCollection$3.notify(RequestCycleListenerCollection.java:97)
> >        at
> >
> org.apache.wicket.util.listener.ListenerCollection$1.notify(ListenerCollection.java:119)
> >        at
> >
> org.apache.wicket.util.listener.ListenerCollection.reversedNotify(ListenerCollection.java:143)
> >        at
> >
> org.apache.wicket.util.listener.ListenerCollection.reversedNotifyIgnoringExceptions(ListenerCollection.java:113)
> >        at
> >
> org.apache.wicket.request.cycle.RequestCycleListenerCollection.onDetach(RequestCycleListenerCollection.java:95)
> >        at
> >
> org.apache.wicket.request.cycle.RequestCycle.onDetach(RequestCycle.java:600)
> >        at
> >
> org.apache.wicket.request.cycle.RequestCycle.detach(RequestCycle.java:539)
> >        at
> >
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:287)
> >        at
> >
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
> >        at
> >
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
> >        at
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> >        ...
> >
> > Looking at our logs, there doesn't seem to be anything interesting going
> on
> > around the time of these exceptions.  We're not spawning any threads on
> our
> > own, and we haven't overridden any serialization-related mechanisms (or
> > defined custom writeObject methods), so I'm at a loss as to where I
> should
> > look for the cause of this error.  Any ideas?
>
> I'd search in Google :-)
> Here are some matching results:
>
> https://groups.google.com/group/memcached-session-manager/browse_thread/thread/195b954d10160348?pli=1
> http://forums.terracotta.org/forums/posts/list/6500.page
>
> The problem is that another thread uses this ArrayList while it is
> being serialized.
> Now you have to find which instance of ArrayList is shared. If it is
> from Wicket code then it is our bug but I guess it is in your code
> otherwise many people would have this problem.
>
> >
> > Thanks!
> >
> > -Allen
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>