Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » ConcurrentModification-Exception in ViewportLayer(?)(A possible race-condition occurs when handling many events in a short time. )
ConcurrentModification-Exception in ViewportLayer(?) [message #1719472] Fri, 08 January 2016 09:02 Go to next message
Dennis Bo is currently offline Dennis BoFriend
Messages: 3
Registered: January 2016
Junior Member
Hi everyone,
I'm using NatTable to display a rather large and dynamic set of entries.
The update ratio is very variable, varying from 0 entries per minute to several hundreds per second.

My underlying data structure is a combination of GlazedLists (EventList -> ObservableList -> FilterList -> SortedList).

Now sometimes I get this exception:

index.php/fa/24539/0/

Most of the time it happens right at the beginning, but it also happens after serveral minutes.

So far as I can see it happens either if too many events travel up the layer-stack in a rather short amount of time or if 2 or more different events reach the ViewportLayer at the same time (like a PropertyChangeEvent from the ObservableList and a StructuralChangEvent from the EventList). But I'm only guessing at this point.

I build the natTable like this:

index.php/fa/24541/0/
index.php/fa/24544/0/
index.php/fa/24543/0/

I hope you can help me with this,
regards Dennis
Re: ConcurrentModification-Exception in ViewportLayer(?) [message #1719544 is a reply to message #1719472] Fri, 08 January 2016 17:47 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Looking at the code at that position it is iterated over the list of EventHandlers. Are you dynamically adding and removing EventHandlers while processing? Or what version of NatTable are you using?

Since you are using the GlazedLIstsEventLayer, there should be no problem with the event processing, because the GlazedLIstsEventLayer collects the events and only processes one event per 100ms to avoid such heavy overprocessing.
Re: ConcurrentModification-Exception in ViewportLayer(?) [message #1719547 is a reply to message #1719544] Fri, 08 January 2016 18:30 Go to previous messageGo to next message
Dennis Bo is currently offline Dennis BoFriend
Messages: 3
Registered: January 2016
Junior Member
Hi Dirk,
I'm using the current version of the NatTable (or so I believe, Build #465). I think I determind the source of the problem. My AutoScrollHandler is listening to RowStructuralChangeEvents. Each time it receives one it determines the last row and triggers moveRowPositionIntoView() of the ViewportLayer. If I understand the source code there correctly this method is registering an EventHandler and 100ms later it unregisters the same one.

When at the same time any other event is handled by the ViewportLayer the ConcurrentModification-Exception occurs.

I'm fresh out of ideas I could try in my own code to prevent this, but i believe if the ViewportLayer would override handleLayerEvent(), registerEventHandler() and the unregisterEventHandler() this could work.
By using a lock object the ViewportLayer could acquire a read-lock before iterating over the eventHandler map and a write-lock before adding or removing a handler. This souldn't decrease the performance by much and it should increase thread-safety for the eventHandlers.

Regards Dennis

[Updated on: Fri, 08 January 2016 18:34]

Report message to a moderator

Re: ConcurrentModification-Exception in ViewportLayer(?) [message #1719548 is a reply to message #1719547] Fri, 08 January 2016 18:50 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Open a ticket and provide a patch if you have a solution for this.
Re: ConcurrentModification-Exception in ViewportLayer(?) [message #1719550 is a reply to message #1719548] Fri, 08 January 2016 19:02 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
BTW, I think it should be fine to to synchronize in the AbstractLayer. It should be quite uncommon to register and unregister event handler while processing events, therefore a read lock should not have too much impact.
Re: ConcurrentModification-Exception in ViewportLayer(?) [message #1719559 is a reply to message #1719548] Fri, 08 January 2016 20:06 Go to previous message
Dennis Bo is currently offline Dennis BoFriend
Messages: 3
Registered: January 2016
Junior Member
Reported possible patch in Bug 485459 via Bugzilla. Hope this will work in general and in my case especially Very Happy
Previous Topic:multi check ComboBox values not gettign saved
Next Topic:New Features for NatTable 1.4
Goto Forum:
  


Current Time: Tue Apr 23 06:29:09 GMT 2024

Powered by FUDForum. Page generated in 0.03749 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top