madflow / flow-netbeans-markdown

Markdown file support for the NetBeans IDE
MIT License
279 stars 40 forks source link

markdown file parse failure makes NB sick #99

Closed eapearson closed 6 years ago

eapearson commented 9 years ago

After including a new dependency in my project, Netbeans went haywire, getting stuck in in project scanning. Not only is the source scanner notification stuck at 100% (or something else on test projects), but the interface becomes sluggish, and my laptop goes into a tailspin.

Running NB with the

-J-Dorg.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.level=FINE

I found that the scanner was stopping on one markdown file, like so:

FINE [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing file /Users/erik/work/projects/markdown-bug/NodeJsWebApplication/bad.md using org.netbeans.modules.csl.core.TLIndexerFactory@7a4f8007; mimeType='text/x-markdown'

This file is actually API.md from the bluebird javascript library. Viewing the file causes NB to hang, but I'm able to whittle it down until I start receiving error dialogs with the content as below. (Note that the error is not emitted until I add a small bit of text on line 574, parsers!)

So a solution? For now I've excluded bower_components from NB using the preferences.

I would rather like to be a bit more specific about excluding problematic files from the scanner. Does anyone know if there is a configuration for this? (I see that the scanondemand plugin has such a setting.)

Anyway, back to this issue. Is this an issue that is appropriate for the NB markdown plugin or directly with the pegdown folks? It is starting to get a little far afield from what I should be doing with my work time...

org.pegdown.ParsingTimeoutException
    at org.pegdown.Parser.checkForParsingTimeout(Parser.java:1522)
    at org.pegdown.Action$cxzDYiA1YTOH9nKV.run(Unknown Source)
    at org.parboiled.matchers.ActionMatcher.match(ActionMatcher.java:96)
    at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
    at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
Caused: org.parboiled.errors.ParserRuntimeException: Error while parsing action 'Root/Sequence/ZeroOrMore/Sequence/Block/FirstOf/Heading/FirstOf/AtxHeading/OneOrMore/Sequence/AtxInline/Inline/Inline_Action1' at input position (line 186, pos 6):
#####`.catch(Function handler)` -> `Promise`
     ^

org.pegdown.ParsingTimeoutException
    at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:366)
    at org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)
    at org.parboiled.matchers.MemoMismatchesMatcher.match(MemoMismatchesMatcher.java:41)
    at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
    at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
    at org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)
    at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
    at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
    at org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)
    at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
    at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
    at org.parboiled.matchers.OneOrMoreMatcher.match(OneOrMoreMatcher.java:38)
    at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
    at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
    at org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)
    at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
    at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
    at org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)
    at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
    at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
    at org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)
    at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
    at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
    at org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41)
    at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
    at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
    at org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)
    at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
    at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
    at org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)
    at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
    at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
    at org.parboiled.matchers.ZeroOrMoreMatcher.match(ZeroOrMoreMatcher.java:39)
    at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
    at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
    at org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)
    at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
    at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
    at org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46)
    at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77)
    at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351)
    at org.parboiled.parserunners.BasicParseRunner.run(BasicParseRunner.java:72)
    at org.parboiled.parserunners.ReportingParseRunner.runBasicMatch(ReportingParseRunner.java:86)
    at org.parboiled.parserunners.ReportingParseRunner.run(ReportingParseRunner.java:66)
    at org.parboiled.parserunners.AbstractParseRunner.run(AbstractParseRunner.java:81)
    at org.pegdown.Parser.parseToParsingResult(Parser.java:1517)
    at org.pegdown.Parser.parseInternal(Parser.java:1504)
    at org.pegdown.Parser.parse(Parser.java:85)
    at flow.netbeans.markdown.csl.MarkdownParser.parse(MarkdownParser.java:35)
    at org.netbeans.modules.parsing.impl.TaskProcessor.callParse(TaskProcessor.java:621)
    at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:251)
    at org.netbeans.modules.parsing.api.ResultIterator.getParserResult(ResultIterator.java:138)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$2.run(RepositoryUpdater.java:3164)
    at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:609)
    at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:153)
    at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:137)
    at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:204)
    at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:201)
    at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:176)
    at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:360)
    at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:141)
    at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:88)
    at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:201)
Caused: org.netbeans.modules.parsing.spi.ParseException
    at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:209)
    at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:104)
[catch] at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.indexEmbedding(RepositoryUpdater.java:3136)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doIndex(RepositoryUpdater.java:2857)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.access$400(RepositoryUpdater.java:2149)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2631)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2629)
    at org.netbeans.modules.parsing.impl.indexing.errors.TaskCache.refreshTransaction(TaskCache.java:564)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.index(RepositoryUpdater.java:2629)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork$4.call(RepositoryUpdater.java:5693)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork$4.call(RepositoryUpdater.java:5601)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$3.run(RepositoryUpdater.java:2122)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:304)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2118)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2099)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.access$1100(RepositoryUpdater.java:157)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork.scanSource(RepositoryUpdater.java:5728)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork.scanSources(RepositoryUpdater.java:5398)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$RootsWork.getDone(RepositoryUpdater.java:5016)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$InitialRootsWork.getDone(RepositoryUpdater.java:5800)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doTheWork(RepositoryUpdater.java:3402)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task._run(RepositoryUpdater.java:6166)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.access$4300(RepositoryUpdater.java:5813)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$3$1.run(RepositoryUpdater.java:6084)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:304)
    at org.netbeans.modules.parsing.impl.RunWhenScanFinishedSupport.performScan(RunWhenScanFinishedSupport.java:106)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$3.call(RepositoryUpdater.java:6080)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$3.call(RepositoryUpdater.java:6076)
    at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:176)
    at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:360)
    at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:141)
    at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:88)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.run(RepositoryUpdater.java:6076)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
    at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
madflow commented 9 years ago

Sorry - I cannot comment on the scanning issue. I know to little about this. What I do remember is, that pegdown has "problems" with a lot of consecutive [. See https://github.com/sirthias/pegdown/issues/104. The API.md file looks pretty similar to the log example in this issue.

So I believe the org.pegdown.ParsingTimeoutException is expected behaviour :S . There is currently a lot of "merging pull requests" going on at pegdown - so maybe it would be a good time to talk to the pegdown people about this.

eapearson commented 9 years ago

Thanks, that looks like it may be similar, although I don't think the API.md file has deeply nested opening characters. However, it is fairly complex and liberal with the usage of special characters, although it does render and validate in other apps, so I suspect pegdown is confused or not forgiving enough with markdown (ab)use. Frankly, this has me now looking for another IDE :( I've become devoted to Netbeans, but the thought that something as straightforward as a markdown file can bring the IDE to a halt, and require hours of debugging is just not something I need in my work life.

stengerh commented 9 years ago

You could still disable or uninstall the Markdown plugin until this issue is resolved. Depending on how familiar your are with NetBeans and other IDEs this may be more efficient than learning another IDE.

At least this Markdown plugin for IntelliJ IDEA is also based on the pegdown library. It therefore may suffer from the same problem.

eapearson commented 9 years ago

Good call! I downloaded intellij, opened up API.md, installed the plugin, and not only did intellij hang, but took 6 cores along with it. At least NB only took 2 :) My current workflow involves markdown documentation alongside api-building and sample programs, so I don't want to disable the otherwise wonderful markdown plugin for the sake of one problematic file. Ideally I'd like to just blacklist that one file, which I'll pursue with the netbeans folks. BTW I spent just a few minutes with Aptana and Intellij and will stick with NB. I'm sure they are fine once you learn them, but I found that I'm not ready to throw out NB and friends just yet. Thanks for paying attention to this.