Infinite loop in LiveGridView (gxt 2.2.5 / gwt 2.3)

Infinite loop in LiveGridView (gxt 2.2.5 / gwt 2.3)

Hi, guys.

Every version of your library has an infinite loop in LiveGridView!!!
I was told before to switch to the latest (at that point 2.2.4 or 2.2.5 version to get rid of it).
I did that eventually. And guess what? There's LiveGridView infinite update loop again. What are your plans on fixing it?!
Are you even supporting gxt 2.2.5?! We've paid money for this library and keep paying for its support!!!

We're not moving to gxt 3, period. This is like porting our application to C#.

If you want details, they are this. LiveGridView's StoreListener.storeDataChanged() method invokes loadLiveStore(), which in turn invokes storeDataChanged again after delay.

I retested it with the new version and it still has the same infinite loop. It depends on the scroller position, but the test is done the way to start looping right away. Just do this to add the component from my first thread:

This example is created to illustrate the problem and to show you that LiveGridView is prone to infinite loop problem. In real application settings are different. Namely, cache size is set to 60 rows, but the problem is harder to reproduce as it happens during scrolling.

Still it's a showstopper as we can't even demo our application to users.

Synchronized LiveGridView would be easy to fix.
All I have to do is to ignore timer task altogether and just call doLoad in the same thread with an in-progress indicator thread.
Asynchronous solution is beyond my expertise.

This sounds like an issue I just discovered today with 2.2.5. When we have a total count of items in the LiveGrid that is close to the cache size we have a problem if we scroll to the end of the grid and then click the column header to sort - it loops forever.

I believe I have worked around the issue with the following code in our custom LiveGridView implementation. I looked at the 3.0.1 code and it looks like it may have the same issue if this is the problem.

I had the same problem with GXT 3.0.1 and found a scenario to reproduce it consistently.

Pre-requisite:

Configure the grid with filter(s) or enable remote sorting in the loader

Enable load mask (this is simply to detect when the problem will start occurring)

To reproduce it, scroll in the grid until we trigger the load mask. At this point, all the states of the LiveGridView are at the point where a loadLiveStore method is being invoked to present the next set of entries in the grid. Then, either click on a header column to trigger a sort or trigger a filter on one of the header where it has been configured. This should trigger infinite invocation of the doLoad through delayed task in the loadLiveStore.

The problem are about the following:

updateRows method

isLoading member

onDataChange handler of the cacheStore

When the onDataChange handler is triggered from a doLoad originating from a header event (sort-filter), the updateRows is invoked with the reload parameter set to true. All the conditions are enabled in the updateRows to trigger another loadLiveStore which will set the isLoading member to true after preparing a delayed task that will invoke the doLoad. However on return, the isLoading flag is reset to false which will cause looping when next delayed task will be invoked since we should expect invocation of the onDataChange again once server result is back.

My workaround consists in the following (I may miss other scenarios where the workaround may not work):

Create another version of the updateRows method using the previous signature and the following implementation to support existing methods using it:

protected void updateRows(int newIndex, boolean reload) {

updateRows(newIndex, reload, false);
}

Update the new updateRows as the following. Trigger the pre caching only if skipPreCaching is set to true. Note that the previous signature set this to false leaving the behavior unchanged for previous invocation: