0

Browser blocked, conflict between threads?

asked 2012-08-09 09:55:09 +0800

cocoes gravatar image cocoes flag of Spain
94 6

Hi,

I'm using ZKEE 6.0.2 . I'm using a thread to update a Tree model very fast, like real time , using Executions.schedule() to queue events with the background thread.

But I'm having strange efects, like browser blocking or events that are produced but never executed anymore.

I'm starting to think that the user interface is the problem: when the user tryes to sort the tree by columns, or to expand a row sometimes the browser gets blocked and the browser process starts to consume 100% CPU.

Is there any way of moving those user actions like sort rows or expand rows to the Executions queue in order to not interfere with the background rendering?

Many thanks

delete flag offensive retag edit

11 Replies

Sort by ยป oldest newest

answered 2012-08-27 06:21:53 +0800

benbai gravatar image benbai
2228 6
http://www.zkoss.org

Hi vicent,

Could you provide a runnable sample that can reproduce this issue for further investigation?

Regards,
Ben

link publish delete flag offensive edit

answered 2013-04-08 15:41:53 +0800

cocoes gravatar image cocoes flag of Spain
94 6

Hi Ben,

some months later, I had the some hours to try to abstract/simulate what are we doing. I put it here:

http://zkfiddle.org/sample/oovs9/6-Browser-blocked-on-tree-update

It does not works exactly the same as my app, because my app has a Thread that updates constantly several trees contents with massive Executions.schedule() events, and I changed that for a "touchable" trees that modify trees just clicking on columns.

The wrong functioning of my app usually happens when sorting trees contents.

In the end, my browser gets blocked on line 43 of this Javascript (Working with EE 6.5.1) (I've tested it will all the latest major browsers): /zkau/web/_zv2012121311/js/zul.sel.wpd , that relates with:

;zkmld(zk._p.p.Treechildren,zk._m);(function(){function c(f){for(;f&&!f.$instanceof(zul.sel.Tree);f=f.parent){if(f.isOpen&&!f.isOpen())...

Also, what I've seen from the server response is a 1300 lines response like this:

{"rs":[["rm",["t_3047"]],...

['zul.sel.Treecell','t_4575',{},[
['zul.wgt.Label','t_4576',{value:'MYVALUE'},[]]
...
,"rid":77}

Do you have any idea about what can be happening? Or a way to debug it without diving into /zkau/web/_zv2012121311/js/zul.sel.wpd javascript?

Thanks in advance

link publish delete flag offensive edit

answered 2013-04-10 11:21:48 +0800

benbai gravatar image benbai
2228 6
http://www.zkoss.org

I tried the sample at zkfiddle, it does not work with ZK 6.5.1 but works well with ZK 5.0.11.

Regarding to debug, you can try open the debug mode at first, please refer to

ZK Client-side Reference>Introduction>Debugging

Then you can try something and see the code then guess the reason, e.g.,

Link to server with another computer to see it is blocked at client side or at server side.

If it is blocked in a while loop in client side js function, maybe there is some condition keeping it looping until something happened, (some update from server side, etc)

And if the model is complex, you can try override getPath() API, please refer to the related issue Unexpected callbacks of AbstractTreeModel and document Tree Model

link publish delete flag offensive edit

answered 2013-04-11 10:23:36 +0800

cocoes gravatar image cocoes flag of Spain
94 6

Hi Ben,

thank you very much. I'll try uncompressing the javascript and debugging with zkjet.

It's a very complex application, with several two level trees updated constantly by the server. It will take several days to debug .

Anyway, very interesting also your two last links, because we also have problems with nodes that we're not able to re-open after they're updated by the server.

I hope all comes from the same problem.

Regards.

link publish delete flag offensive edit

answered 2013-04-15 12:03:24 +0800

cocoes gravatar image cocoes flag of Spain
94 6

Hi again Ben,

I finally found the problem with the javascript debugging.

One of the tree renderers was failing due to an infinite loop on the third line here:

 _renderChildHTML: function (childHTML) {
    var w = this.previousSibling;
    for (;w; w = this.previousSibling) // INFINITE LOOP HERE
        if (w.treerow) break; 

    if (w) {
        jq(w.treerow.$n()).after(childHTML);
    } else if (w = this.nextSibling) {
        for (;w; w = this.nextSibling)
            if (w.treerow) break;
        if (w)
            jq(w.treerow.$n()).before(childHTML);
    } else if (w = this.getParentItem()) {
        w._renderChildHTML(childHTML);
    } else if ((w = this.getTree())) {
    jq(w.$n('rows')).append(childHTML);
    }
},insertChildHTML_: function (child, before, desktop) {
    if (before = before ? before.getFirstNode_(): null)
        jq(before).before(child.redrawHTML_());
    else
        this._renderChildHTML(child.redrawHTML_());
    child.bind(desktop);
},

The difference of the failing tree renderer with the other renderers was that it was using the following code at the beginning of the renderer:

        Treerow tr = treeItem.getTreerow();
        if(tr == null) {
            tr = new Treerow();
        } else {
            tr.getChildren().clear();
        }       
        treeItem.appendChild(tr);

Instead of using the following one:

    Treerow tr;
    if (treeItem.getTreerow() == null) {
        tr = new Treerow();
        tr.setParent(treeItem);
    } else {
        tr = treeItem.getTreerow();
        tr.getChildren().clear();
    }

Best regards,

Vicente

link publish delete flag offensive edit

answered 2013-04-16 07:48:09 +0800

benbai gravatar image benbai
2228 6
http://www.zkoss.org

I cannot find the code that cause this issue from source code now, did you customize it? Or maybe it is a fixed issue.

Ref:

Tree.java

BindTreeitemRenderer.java

link publish delete flag offensive edit

answered 2013-04-16 08:20:42 +0800

cocoes gravatar image cocoes flag of Spain
94 6

Hi benbai,

I was not able to put the real code on zkfiddle due to the complexity of it, so I put a sample that tryed to simulate what I was doing.

Anyway I was not able to simulate the browser blocking in zkfiddle, but fortunately the javascript debugging mode allowed me to find that just one of all the tree renderers was failing and blocking browser due to a different row rendering.

Regards.

link publish delete flag offensive edit

answered 2013-04-16 11:22:30 +0800

cocoes gravatar image cocoes flag of Spain
94 6

Hi again benbai.

I thought I'd solve the problem, but I've just tryed to migrate from ZKEE 6.5.1.1 to ZKEE 6.5.2 and the problem has multiplied.

Now if I test it with Internet Explorer I got the following error on server console:

No se puede obtener valor de la propiedad 'style': el objeto es nulo o esta sin definir (TypeError)
12:04:38,332 SEVERE [zkoss] [Desktop z_seh:/xxx/index.zul] client error: Fallo al procesar rm

Translating it to English must be something like

style property value cant be obtained: object is null or undefined (TypeError)
12:04:38,332 SEVERE [zkoss] [Desktop z_seh:/xxx/index.zul] client error: Error processing rm

And the browser starts to push the same error on popups, until it gets blocked.

Firefox and Chrome get blocked from the beginning.

Debuging with Firefox, I've seen the same point that seemed to get solved with version 6.5.1.1 , using the referenced Tree rendering:

_renderChildHTML: function (childHTML) {
   var w = this.previousSibling;
   for (;w; w = this.previousSibling)
      if (w.treerow) break;

Is there any change from version 6.5.1.1 to 6.5.2 that could affect Tree/MVC rendering? If I go back to previous version it starts automatically working again...

Regards,

Vicente

link publish delete flag offensive edit

answered 2013-04-16 11:57:37 +0800

cocoes gravatar image cocoes flag of Spain
94 6

I've updated the demo :

http://zkfiddle.org/sample/oovs9/7-Browser-blocked-on-tree-update

To test it simply click on c1 & c2 cells, it will update it's content with aleatory numbers.

The cells update is not as fast as our real application, but I've been able to block several times the browser with version 6.5.2.

I also have seen that, as in our app, the row leafs don't expand after the row is updated, you have to order the tree to make it work again.

I must be doing something wrong...

link publish delete flag offensive edit

answered 2013-04-16 12:05:35 +0800

cocoes gravatar image cocoes flag of Spain
94 6

Well, finally I've found when does it gets blocked: when I update leafs content of columns c1 and c2 simply clicking on them.

It works with 6.5.1 , but allways blocks on 6.5.2.

Regards and sorry for the "spam",

Vicente

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2012-08-09 09:55:09 +0800

Seen: 169 times

Last updated: Apr 18 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More