use xref timeout for XMLAnalyzer #4328
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When indexing AOPS, I noticed that the indexer has a tail in which only bunch of CPUs are executing. The stacks of these look like this:
and are likely related to #907 or #3740.
By adding xref timeout to
XMLAnalyzer#analyze()similarly to what is already done inPlainAnalyzer#analyze(), this reduced the indexing time significantly (from 1 hour and 40 minutes to 35 minutes).There are bunch of other analyzers that override the
analyze()method that do not use the xref timeout, howeverXMLAnalyzeris probably one that suffers from this problem most. At this point I don't see a way of pushing the xref timeout upwards, because theanalyze()methods differ. E.g.PlainAnalyzer#analyzer()runs ctags, that has its own timeout.Example of a AOSP file causing the timeout:
/AOSP/hardware/qcom/sm8150/display/config/qdcm_calib_data_sw43404_amoled_cmd_mode_dsi_boe_panel_with_DSC.xml(1.8MB). This one has a long strings of hexadecimal numbers as XML element values.This change merely works around the problems referenced by the issues above so a fix should still be done to the
XMLAnalyzers' lexical parser not choke on certain files.Lastly, there is probably some refactoring potential to move the
CompletableFutureand the code setting the timeout to a method, possibly rework theXrefWorkclass (sic!), avoiding code duplication inPlainAnalyzerandXMLAnalyzer.