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

Bug 482338

Summary: GridRowContainer.getToolTipTargetBounds can be called when _hoverRow is null
Product: [RT] RAP Reporter: Wolfgang Pedot <wolfgang.pedot>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: tbuschto
Version: 3.1   
Target Milestone: 3.1 M4   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Shows calls to GridRowContainer._setHoverItem with RWT.FIXED_COLUMNS set
none
Shows calls to GridRowContainer._setHoverItem with RWT.FIXED_COLUMNS not set
none
Shows a scroll-timing hit (scrolling between requestCellToolTipText and its response) but no crash
none
Shows a prevented crash when scroll-timing is hit none

Description Wolfgang Pedot CLA 2015-11-17 04:54:22 EST
We are experiencing sporadic client-crashes on 3.1M2 across different browsers (Chrome, IE, FireFox) when scrolling in virtual and non-virtual Tables with ToolTips. The set-operation with property cellToolTipText fails because "getTop" is called on a null-object.

I tracked the problem down to GridRowContainer.getToolTipTargetBounds, that method can get called when the member _hoverRow is null and that means GridCellToolTipSupport.getCurrentToolTipTargetBounds fails because it can not handle a null-parameter.

GridRowContainer.requestToolTipText also gets called frequently with _hoverRow = null but that alone does not crash the client.

From the stacktraces I figured that those methods get called from a timer/interval so there might be a timing-issue with _hoverRow while scrolling. I have added a null-check to  GridCellToolTipSupport.getCurrentToolTipTargetBounds and just return a bounds-object with all the members set to 0 and the crashes appear to be gone.
Comment 1 Wolfgang Pedot CLA 2015-11-17 05:10:24 EST
Forgot to mention: the mouse-cursor needs to hover over the table while scrolling so mostly mousewheel/trackpad-scrolling is affected.
Comment 2 Ivan Furnadjiev CLA 2015-11-17 07:15:53 EST
Is this crash are regression or can be reproduced with RAP 3.0? Could you provide a simple snippet to demonstrate the issue? I can't reproduce it with Controls Demo -> TableViewer Tab.
Comment 3 Wolfgang Pedot CLA 2015-11-17 08:52:12 EST
I´ll have to test this with 3.0.
I tried to reproduce it in the Demo (same RAP-Bundles) with ToolTips but it seems to be impossible there. I managed to get _hoverItem to be null between requestToolTipText and setCellToolTipText but the tooltip was never rendered in those cases so there was no call to getToolTipTargetBounds and therefor no crash. I also noticed that there are lots of calls to getToolTipTargetBounds when moving the mouse-cursor inside the cell that triggered the tooltip, could this be somwhow theme-related (our app used smaller rows)?

The issue is always tricky to reproduce because the timing has to be just right (usually scrolling, then halt short, then scroll further) and sometimes I have to try for quite some time before I get it to crash with our application. However I did not manage to crash the demo....
Comment 4 Wolfgang Pedot CLA 2015-11-18 11:19:08 EST
Created attachment 258123 [details]
Shows calls to GridRowContainer._setHoverItem with RWT.FIXED_COLUMNS set
Comment 5 Wolfgang Pedot CLA 2015-11-18 11:20:13 EST
Created attachment 258124 [details]
Shows calls to GridRowContainer._setHoverItem with RWT.FIXED_COLUMNS not set
Comment 6 Wolfgang Pedot CLA 2015-11-18 11:20:49 EST
Created attachment 258125 [details]
Shows a scroll-timing hit (scrolling between requestCellToolTipText and its response) but no crash
Comment 7 Wolfgang Pedot CLA 2015-11-18 11:21:14 EST
Created attachment 258126 [details]
Shows a prevented crash when scroll-timing is hit
Comment 8 Wolfgang Pedot CLA 2015-11-18 11:22:02 EST
I have tested on a RAP 3.0 based and I can reproduce the issue there as well.
It does appear to be easier to reproduce on FireFox (41.0.1) for me but there are reports with other browsers as well.

After further investigation I also managed to crash the demo now, appearantly RWT.FIXED_COLUMNS is a key factor. Once I enabled that (and tooltips) I could reproduce the issue in the demo. The scroll-timing is crucial though, one has to scroll right when the "requestToolTip" call goes out to the server and before the answer is processed. Then there is another window to hit because GridRowContainer._hoverItem has to be null at the right moment.

I have added lots of console.logs to try and find out what is happening and I attached some logfiles. There is a noticeable difference in the output depending on the presence of FIXED_COLUMNS, there seem to be much more calls and the "row" parameter is quite often undefined.
Comment 9 Tim Buschtoens CLA 2015-11-27 07:21:16 EST
I think I managed to reproduce the scenario in a unit test. However, it requires the mouse to hover the grid clientArea, but none of the rows. I'm not sure how that would be possible, since the entire client area consists of rows.
Comment 10 Wolfgang Pedot CLA 2015-11-27 08:06:22 EST
I have received numerous reports of this from users so it appears to be quite common. It happens quite often for some, not so much for others. The type of input-device may also be a factor, some are reporting more problems when using a mousewheel compared to a trackpad on the same machine but that may also be because of different usage patterns and timings.
Comment 11 Tim Buschtoens CLA 2015-11-30 05:45:55 EST
Fixed with Commit ac2a2d72588aebfa1d71d17672189e063edc88eb. HoverItem is now checked before rendering the tooltip.