This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 270038 - Navigator and syntax highlighting sometimes broken on CSS file opening
Summary: Navigator and syntax highlighting sometimes broken on CSS file opening
Status: NEW
Alias: None
Product: web
Classification: Unclassified
Component: CSS Editor (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Milutin Kristofic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-09 15:51 UTC by fashukiexp
Modified: 2017-03-09 15:57 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Stack traces when CssParser is cancelled (9.76 KB, text/plain)
2017-03-09 15:57 UTC, fashukiexp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description fashukiexp 2017-03-09 15:51:40 UTC
In an internal program based on Netbeans platform 8.0.2, after opening and closing a CSS file several times, the syntax highlighting may not be executed (only comments are in gray)
and/or the navigator is stuck with "Please wait". Doing any modification in the text editor updates both of them properly.

I could only reproduce it once with Netbeans IDE 8.0.2 and 8.1.

It look like the old bugs 175576 (2009) and 215180 (2012).

== Investigation details ==
I don't know much about the editors design, and I tried to understand the logic as much as I could.

=== Traces ===
With the following command line parameter -J-Dorg.netbeans.modules.parsing.impl.TaskProcessor.level=100 , I can see that some tasks related to the parsing are cancelled:

Finished  CANCELED Task: Periodic request 867408075 to perform: org.netbeans.modules.csl.navigation.ClassMemberNavigatorSourceFactory$ProxyElementScanningTask@2edd3cec on: SourceCache 874077146: application-page.css

There are similar lines for CssCaretAwareSourceTask, CaretListeningTask, SuggestionsTask, SelectionHintsTask, HintsTask, MarkOccurrencesHighlighter, etc...

=== Navigator issue ===
As far as I understand, the navigator is updated ("ClassMemberPanelUI.refresh") when "ClassMemberNavigatorSourceFactory$ProxyElementScanningTask" is completed. But in my case this task is cancelled because "CssParser" is also canceeled.

=== CssParser issue ===
I put some traces for methods of the class "Cssparser", and I got these two scenarios when opening a CSS.

- OK:
CssParser#parse
CssParser#parse
CssParser#cancel()
CssParser#cancel()
CssParser#parse
CssParser#parse

- KO
CssParser#parse
CssParser#parse
CssParser#cancel()
CssParser#cancel()
CssParser#parse
CssParser#parse
CssParser#cancel() <=== added
CssParser#cancel()
In org.netbeans.modules.parsing.impl::TaskProcessor::CompilationJob::run(), currentResult = sourceCache.getResult(r.task) is null many times

I tried to find when this "cancel()" is called, and it seems that it is triggered by "org.openide.text.DocumentOpenClose$DocumentLoad$1.run". Stack trace in attachment.
Comment 1 fashukiexp 2017-03-09 15:57:15 UTC
Created attachment 163807 [details]
Stack traces when CssParser is cancelled

Attached 2 stack traces showing that the CssParser is cancelled, in the case the bug is reproduced.