Skip to content

limit addFile() processing time #4550

Open
@vladak

Description

@vladak

When indexing bunch of projects, the indexer (based on 1.13.4) had a trailing worker thread that was spinning on the CPU for inordinate amount of time (minutes) while all the other files were finished. The stack trace looked like this (comes from my branch when experimenting with the fix for #4549 so thread name and line numbers do not match):

"OpenGrok-index-worker-48" #48 prio=5 os_prio=0 cpu=773733,68ms elapsed=1140,14s tid=0x00007f3648023000 nid=0x2134a7 runnable  [0x00007f364e5fd000]
   java.lang.Thread.State: RUNNABLE
	at org.opengrok.indexer.analysis.javascript.JavaScriptSymbolTokenizer.yylex(JavaScriptSymbolTokenizer.java:1645)
	at org.opengrok.indexer.analysis.JFlexTokenizer.incrementToken(JFlexTokenizer.java:106)
	at org.apache.lucene.index.IndexingChain$PerField.invertTokenStream(IndexingChain.java:1167)
	at org.apache.lucene.index.IndexingChain$PerField.invert(IndexingChain.java:1145)
	at org.apache.lucene.index.IndexingChain.processField(IndexingChain.java:697)
	at org.apache.lucene.index.IndexingChain.processDocument(IndexingChain.java:576)
	at org.apache.lucene.index.DocumentsWriterPerThread.updateDocuments(DocumentsWriterPerThread.java:243)
	at org.apache.lucene.index.DocumentsWriter.updateDocuments(DocumentsWriter.java:421)
	at org.apache.lucene.index.IndexWriter.updateDocuments(IndexWriter.java:1551)
	at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1836)
	at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1476)
	at org.opengrok.indexer.index.IndexDatabase.addFile(IndexDatabase.java:1278)
	at org.opengrok.indexer.index.IndexDatabase.lambda$indexParallel$9(IndexDatabase.java:1920)
	at org.opengrok.indexer.index.IndexDatabase$$Lambda$370/0x00000008401e7c40.call(Unknown Source)

Specifically, the file in question came from the https://hg.mozilla.org/mozilla-central , it was testing/modules/sinon-7.2.7.js which contains long lists of numbers. Such files are known to cause problems. Ideally the analyzers should skip/truncate the files with huge number of terms.

The indexer eventually finished, however there should be some time limit for addFile() or writer.addDocument() processing. There is already timeout enforced for xref production via the XrefWork class.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions