ZK - Open Source Ajax Java FrameworkZK - Open Source Ajax Java Framework

Grid error on redraw

sumi
23 Feb 2010 02:52:32 GMT
23 Feb 2010 02:52:32 GMT

I have a grid on a page whose model is refreshed every 5 seconds. The grid also has a listbox and a button in the model(in each row). It works OK, but when the page is left open for 24 hours, it gives out a message: Redraw :Failed to process addAft 'nodeType' is null or not an object. This happened with IE and zk 3.6.4
Following are other details on how the grid is implemented:
On every refresh, the objects in the model doesnt change, but only the values. I have a model of Class A objects. Each of the objects in the model are also stored in a hashmap with a key, so that on a refresh, I jus update the values in the object using get/set methods.

henrichen
23 Feb 2010 04:05:52 GMT
23 Feb 2010 04:05:52 GMT

How do you "refreshed every 5 seconds"? by onTimer?

sumi
23 Feb 2010 04:15:37 GMT
23 Feb 2010 04:15:37 GMT

Yes, the refresh is done by onTimer

henrichen
23 Feb 2010 04:42:52 GMT
23 Feb 2010 04:42:52 GMT

Check this:

http://docs.zkoss.org/wiki/Developer_reference_Appendix_B._WEB-INF/zk.xml_Overview_The_session-config_Element#The_timer-keep-alive_Element

sumi
25 Feb 2010 23:24:40 GMT
25 Feb 2010 23:24:40 GMT

I tried putting timer-keep-alive in the web.xml, and still it complains of the same problem...The following is how my web.xml looks for the session-config element
<session-config>
<session-timeout>86400</session-timeout>
<device-type>ajax</device-type>
<timeout-uri>/index.zul</timeout-uri>
<timer-keep-alive>true</timer-keep-alive>
</session-config>

henrichen
26 Feb 2010 00:35:40 GMT
26 Feb 2010 00:35:40 GMT

Please post to ZK bugs along with a SIMPLE WORKING test case sample code. We will track from there.

sumi
4 Mar 2010 23:25:05 GMT
4 Mar 2010 23:25:05 GMT

Hi,
I will do that. But there is something more I want to add. I was earlier using listbox instead of grid with ZK 3.6.0 version, and it did not have this problem. Then , we had memory leak problem with IE8 with listbox(firefox did not have this problem), and then I changed it to grid, with the ZK 3.6.4-FL-2010-01-04. It still has both memory leak and the redraw problem now. I have also tried with ZK 3.6.4-FL-2010-03-02. It also has the both problems mentioned above. Is there a known memory leak issue for listbox and grid with IE8?

sumi
8 Mar 2010 23:10:13 GMT
8 Mar 2010 23:10:13 GMT

Hello,

I also have a menu bar in the page, and clicking on it shows error and the menu doesnt popup. I tried to debug it with the debugger, and it pointed out that function setZKAttr(b,a,c){if(b&&b.setAttribute){b.setAttribute("z."+a,c)} is in zk.js is where the problem occurs. Does this provide a clue to where the problem occurs?

sumi
8 Mar 2010 23:21:08 GMT
8 Mar 2010 23:21:08 GMT

Hello,
The above menu problem occurs when the page is kept open for more than 10 hours.When opening a duplicate tab in the same explorer, it works.
Also for the memory leak, it has become better when I manually removed each child from the grid before refreshing it.Following is the refresh function that is called every 10seconds.I did this because I saw that there were many leaks with class as zk-row when checking using Drip memory leak detector.Can anyone help here?
void loadData() {
try {
ListModel lst=null;

if(first)
{
lst=mainOverview.getFilteredListboxData();
mainGrid.setModel(lst);
first=false;
}else{
lst=mainGrid.getListModel();
Rows rows=mainGrid.getRows();
List children=rows.getChildren();
for(int i=0;i<children.size()-1;i++)
{
List subChildren=((Component)children.get(i)).getChildren();
for(int j=0;j<subChildren.size()-1;j++)
{
((Component)children.get(i)).removeChild((Component)subChildren.get(j));
}
mainGrid.removeChild((Component)children.get(i));
}
mainOverview.getFilteredListboxData();
lst=mainOverview.getFilteredListboxData();
mainGrid.setModel(lst);
}
} catch (Exception e) {
Messagebox.show(SqlErrorParser.parseError(e), "Error",
Messagebox.OK, Messagebox.ERROR);
}
}
The grid looks like this:
<grid id="vsatListbox" rowRenderer="${mainOverview}" onDrop="unloadData();">

<columns>
<column label="Device" width="120px"/>
<column label="Mode" width="120px"/>
<column label="Status" width="100px"/>
<column width="140px" align="center" >
<label id="h1" value="FWD IP Rate " sclass="word-wrap" multiline="true" />
</column>
<column width="140px" align="center" >
<label id="h2" value="RET IP Rate " sclass="word-wrap" multiline="true" />
</column>
<column width="110px" align="center" >
<label id="h3" value="CPU load [%] " sclass="word-wrap" multiline="true"/>
</column>
<column width="100px" align="center">
<label id="h4" value="#TCP Conn " sclass="word-wrap" multiline="true"/>
</column>
<column width="140px" align="center">
<label id="h5" value="#Packets Dropped " sclass="word-wrap" multiline="true"/>
</column>

</columns>
<rows>

</rows>
</grid>


The renderer looks like this
public void render(Row item, Object data) throws Exception {
//log.debug("In render");
MainOverview term = (MainOverview) data;
String devName="";
try {
if (term != null) {
devName=term.getM_deviceType()+"-"+String.format("%02d", term.getM_device()-term.getM_displayfactor());

item.appendChild(new Label(devName));
item.appendChild(new Label(term.getM_mode()));
item.appendChild(new Label(term.getM_status()));
item.appendChild(new Label(term.getM_fwd_ip_rate()));
item.appendChild(new Label(term.getM_ret_ip_rate()));
item.appendChild(new Label(term.getM_cpu_load()));
item.appendChild(new Label(term.getM_tcp_conn()));
item.appendChild(new Label(term.getM_pkts_dropped()));



}
} catch (Exception e) {
log.error(e.getMessage());

}
}

henrichen
9 Mar 2010 20:32:44 GMT
9 Mar 2010 20:32:44 GMT

Thanks for the information. But it is better go into bug tracking system so we can track them and hopefully fix them.