Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 368428

Summary: cyclical setTimeout from qx.ui.core.Widget._autoFlushHelper
Product: [RT] RAP Reporter: Andrei Neshcheret <a.nesheret>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: tbuschto
Version: unspecified   
Target Milestone: 1.5 M5   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Attachments:
Description Flags
Run it and Press Do It button.
none
Image from Chrome Dev tools
none
Image with closed first timer line
none
Simplified snipped. none

Description Andrei Neshcheret CLA 2012-01-12 04:57:06 EST
Build Identifier: Version: 3.7.1 Build id: M20110909-1335

High CPU load
function _initAutoFlush called from _autoFlushHelper!, and always sets the timer again and again.


Reproducible: Always

Steps to Reproduce:
1. Run Snipped
2. Press Do it button.
Comment 1 Andrei Neshcheret CLA 2012-01-12 04:59:09 EST
Created attachment 209357 [details]
Run it and Press Do It button.
Comment 2 Andrei Neshcheret CLA 2012-01-12 05:04:40 EST
Trailing <space> is important in setText.
Comment 3 Tim Buschtoens CLA 2012-01-12 07:51:50 EST
Can not reproduce with this snippet. A timer is running as result of the history support, but thats it. I tried with different themes, different browser and with standard and debug js library.

Stack trace from newsgroup:

qx.Class.define.statistics._initAutoFlash        rap-client-9e5d6670.js:9629
qx.Class.define.statistics.addToGlobalJobQueue        rap-client-9e5d6670.js:9775
qx.Class.define.members.addToJobQueue            rap-client-9e5d6670.js:11438
qx.Class.define.members.addToQueueRuntime        rap-client-9e5d6670.js:12007
proto.(anonymous function)                rap-client-9e5d6670.js:4042
qx.Class.define.members._invalidateTotalSpacing     rap-client-9e5d6670.js:55169
qx.Class.define.members.setCellWidth            rap-client-9e5d6670.js:54809
qx.Class.define.members._beforeRenderLayout        rap-client-9e5d6670.js:60961
qx.Class.define.members._layoutPost            rap-client-9e5d6670.js:55191
qx.Class.define.members._layoutChild            rap-client-9e5d6670.js:15710
qx.Class.define.members.flushChildrenQueue        rap-client-9e5d6670.js:18861
qx.Class.define.members._flushChildrenQueue        rap-client-9e5d6670.js:15648
qx.Class.define.statistics.flushGlobalLayoutQueue rap-client-9e5d6670.js:9827
qx.Class.define.statistics.flushGlobalQueues        rap-client-9e5d6670.js:9668
qx.Class.define.statistics._autoFlushHelper        rap-client-9e5d6670.js:9646 

This seems to indicate a problem with layouting the ToolItem. Either the calculation of the text-width somehow returns incosistent values, or the values are not applied correctly. (Maybe a rounding error?) As long i can't reproduce it, its hard to fix. If the trailing space triggers this, perhaps we can just strip it? (Either in EncodingUtil.js, in MultiCellWidget.js, or in ToolItem.js.)
Comment 4 Andrei Neshcheret CLA 2012-01-12 08:13:02 EST
More investigation: Problem occur in ToolBar with SWT.DROP_DOWN item style.
Comment 5 Andrei Neshcheret CLA 2012-01-12 08:24:28 EST
(In reply to comment #3)
> Can not reproduce with this snippet. A timer is running as result of the
You can. 
  1. Run snipped in Chrome.
  2. Press DoIt button (5 or 6 times).
CPU ~0%, but this depend on page content (my application have a lot controls in page).
---
dont stop here
   1. Open Chrome Development tools
   2. Goto Timeline page
   3. Record for few seconds.
   4. Open first (continuos) Timer fired
Comment 6 Andrei Neshcheret CLA 2012-01-12 08:25:22 EST
Created attachment 209371 [details]
Image from Chrome Dev tools
Comment 7 Andrei Neshcheret CLA 2012-01-12 08:30:52 EST
Created attachment 209372 [details]
Image with closed first timer line

Same recorded timeline but with closed timer line.
Comment 8 Tim Buschtoens CLA 2012-01-12 10:22:38 EST
Okay, got it. The "high CPU load" is only 2-4% for me, i assumed that that wasnt it.
Comment 9 Andrei Neshcheret CLA 2012-01-13 00:40:59 EST
Created attachment 209427 [details]
Simplified snipped.

This is Theme dependent too with same stacktrace. My Application use Business theme.
Run this with themeId="org.eclipse.rap.design.example.business.theme"
Comment 10 Ivan Furnadjiev CLA 2012-01-13 02:36:01 EST
Andrew, maybe I missed something, but which version of RAP are you using? Is it reproducible against nightly build (CVS HEAD)? Could be related to Bug 333858 (bug 301236)?
Comment 11 Andrei Neshcheret CLA 2012-01-13 06:27:01 EST
(In reply to comment #10)
> Andrew, maybe I missed something, but which version of RAP are you using? Is it
> reproducible against nightly build (CVS HEAD)? Could be related to Bug 333858
> (bug 301236)?
Yes, latest RAP 1.5 from http://download.eclipse.org/rt/rap/nightly/runtime/
Comment 12 Tim Buschtoens CLA 2012-01-13 07:05:38 EST
The problem are these two lines in ToolItem.js:

this.setCellWidth( 0, 0 );
this.setCellWidth( 2, null );

i think they should be 

this._setCellWidth( 0, 0 );
this._setCellWidth( 2, null );

but i have to make a few tests first.
Comment 13 Tim Buschtoens CLA 2012-01-13 10:36:30 EST
Fixed in CVS HEAD as described above.

In the long run this layout code should be rewritten, its a mess!