problem in SQLContainer

This is with Vaadin 7.4.3. We have a table that uses SQLContainer as its container data source. We only use the container for displaying data – a background thread sometimes adds/deletes rows from the table being used. When something was being deleted from the table, the UI hit this exception during a refresh (we use polling):

[#|2015-04-24T20:10:45.220+0100|SEVERE|glassfish3.1.2|com.vaadin.server.DefaultErrorHandler|_ThreadID=25;_ThreadName=Thread-2;|java.lang.RuntimeException: Unable to get item id for index: 1 from container using Container.Indexed#getIdByIndex() even though container.size() > endIndex. Returned item id was null. Check your container implementation!
    at com.vaadin.data.ContainerHelpers.getItemIdsUsingGetIdByIndex(ContainerHelpers.java:90)
    at com.vaadin.data.util.sqlcontainer.SQLContainer.getItemIds(SQLContainer.java:719)
    at com.vaadin.ui.Table.getItemIds(Table.java:2241)
    at com.vaadin.ui.Table.getVisibleCellsNoCache(Table.java:2191)
    at com.vaadin.ui.Table.refreshRenderedCells(Table.java:1717)
    at com.vaadin.ui.Table.refreshRowCache(Table.java:2661)
    at com.vaadin.ui.Table.containerItemSetChange(Table.java:4547)
    at com.vaadin.data.util.sqlcontainer.SQLContainer.fireContentsChange(SQLContainer.java:1627)
    at com.vaadin.data.util.sqlcontainer.SQLContainer.refresh(SQLContainer.java:910)
    at com.vaadin.data.util.sqlcontainer.SQLContainer.refresh(SQLContainer.java:892)
[...application code...]

Is that a timing bug in SQLContainer? We’ve been using this for a long time and haven’t seen this issue before. Is there something else we should do before adding/deleting rows from the table? I suppose we could work around this by getting the UI lock before altering the table, but I was hoping something like that wasn’t needed since db table ought to be able to change at any time.

Thanks,
Bobby

Hi,

are you using com.vaadin.ui.UI.access(Runnable) to do the Table update?

-tepi

[Sorry, just now saw there was a reply here. For some reason didn’t get an email about it.]

The database table is updated my several background threads that are unrelated to the UI. Every 10 seconds, the UI refreshes and reloads information from the table. My guess is that the SQLContainer isn’t fetching the data as a single operation, so in rare cases there could be an issue like this.

Thanks,
Bobby