You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Auwelord <da...@gmail.com> on 2019/02/12 17:28:35 UTC

ConcurrentModificationException in PageStore.serializePage

Hello,

I have an issue when i refresh a component using WebSocket.

My page contains a form which asks consecutive question to the user. The
submit button (ajax) refreshes the form itself, and during the process of
validation, a thread may be created to run a long procedure and when it is
finished, communicate the results to the user via WebSocket, modifying a div
tag.

So the result may occur when a new question is asked (ie the form is
refreshing)

The exception occurs when both requests need to update the page in the page
store.

I know PageSavingRunnable is thread safe (only one instance by app) but i
don't understand why it doesn't work in my case ? Is it possible to refresh
using a threaded WebSocket procedure, while refreshing by an ajax request ?

Thanks


--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: ConcurrentModificationException in PageStore.serializePage

Posted by Auwelord <da...@gmail.com>.
i agree. i think this is the collection of the listview that is being
modified.
But i don't really know how to prevent (temporarly) serialization (from
update by websock), while the list is being updated by the ajax request.
Anyway, thanks a lot for your help

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: ConcurrentModificationException in PageStore.serializePage

Posted by sven <sv...@meiers.net>.
 
 
Hi,
 

 
your listview's model should hold a copy of the list only.
 

 
Or you can keep the list outside of the component tree and give your listview a LDM only. This way it won't be serialized at all.
 

 
Sven
 
 
 

 
 
 
 
 
>  
> On 14.02.2019 at 16:54,  <Auwelord>  wrote:
>  
>  
>  i agree. i think this is the collection of the listview that is being modified. But i don't really know how to prevent (temporarly) serialization (from update by websock), while the list is being updated by the ajax request. Anyway, thanks a lot for your help -- Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org For additional commands, e-mail: users-help@wicket.apache.org 
>  
     

Re: ConcurrentModificationException in PageStore.serializePage

Posted by Auwelord <da...@gmail.com>.
I don't have references to my page.
I've tried to store pages in synchronous mode
(getStoreSettings().setAsynchronous(false)) with the same result...

The problem occurs when it Serialize a ListView, here's the stack :
ArrayList is a list of ListItem

ArrayList<E>.writeObject(ObjectOutputStream) line: 770	
...
JavaSerializer$SerializationCheckerObjectOutputStream(ObjectOutputStream).writeObject(Object)
line: 344	
JavaSerializer.serialize(Object) line: 82	
DefaultPageStore(AbstractPageStore).serializePage(IManageablePage) line: 133	
DefaultPageStore.createSerializedPage(String, IManageablePage) line: 281	
DefaultPageStore.storePage(String, IManageablePage) line: 61	
...
JavaxWebSocketProcessor(AbstractWebSocketProcessor).broadcastMessage(IWebSocketMessage)
line: 258	

When i submit my form (in ajax mode), i refresh the list, adding the
response of the user

Here is a picture !! :))

<http://apache-wicket.1842946.n4.nabble.com/file/t375925/CMEWS.png> 


--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: ConcurrentModificationException in PageStore.serializePage

Posted by sven <sv...@meiers.net>.
 
 
Seems your page is holding a collection that is modified on your worker thread.
 

 
Try holding a defensive copy of your data structure in your Wicket components.
 

 
Sven
 
 
 

 
 
 
 
 
>  
> On 13.02.2019 at 10:43,  <Auwelord>  wrote:
>  
>  
>  I don't have references to my page. I've tried to store pages in synchronous mode (getStoreSettings().setAsynchronous(false)) with the same result... The problem occurs when it Serialize a ListView, here's the stack : ArrayList is a list of ListItem ArrayList.writeObject(ObjectOutputStream) line: 770 ... JavaSerializer$SerializationCheckerObjectOutputStream(ObjectOutputStream).writeObject(Object) line: 344 JavaSerializer.serialize(Object) line: 82 DefaultPageStore(AbstractPageStore).serializePage(IManageablePage) line: 133 DefaultPageStore.createSerializedPage(String, IManageablePage) line: 281 DefaultPageStore.storePage(String, IManageablePage) line: 61 ... JavaxWebSocketProcessor(AbstractWebSocketProcessor).broadcastMessage(IWebSocketMessage) line: 258 When i submit my form (in ajax mode), i refresh the list, adding the response of the user Here is a picture !! :)) -- Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html --------------------------------
------------------------------------- To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org For additional commands, e-mail: users-help@wicket.apache.org 
>  
     

Re: ConcurrentModificationException in PageStore.serializePage

Posted by Sven Meier <sv...@meiers.net>.
Hi,

all requests to pages are synchronized, it doesn't matter whether Ajax 
or WebSockets is involved.

Are you holding hard references to your pages and calling methods on them?

Or have you tried without asynchronous page saving and the error does'nt 
show up?

Have fun
Sven

Am 12.02.19 um 18:28 schrieb Auwelord:
> Hello,
>
> I have an issue when i refresh a component using WebSocket.
>
> My page contains a form which asks consecutive question to the user. The
> submit button (ajax) refreshes the form itself, and during the process of
> validation, a thread may be created to run a long procedure and when it is
> finished, communicate the results to the user via WebSocket, modifying a div
> tag.
>
> So the result may occur when a new question is asked (ie the form is
> refreshing)
>
> The exception occurs when both requests need to update the page in the page
> store.
>
> I know PageSavingRunnable is thread safe (only one instance by app) but i
> don't understand why it doesn't work in my case ? Is it possible to refresh
> using a threaded WebSocket procedure, while refreshing by an ajax request ?
>
> Thanks
>
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org