Back to LanguageTool Homepage - Privacy - Imprint

[Resolved] XGBoost warning and OutOfMemoryError when checking English with ngram

Hi all,
when starting my local server with:

java -cp languagetool-server.jar org.languagetool.server.HTTPServer --port 8081 --allow-origin '*' --public --config server.properties

(server.properties contains “languageModel=C:/LanguageTool/ngram, maxTextLength=20000”)

If I check German text (e.g. “In den christlichen Traditionen gibt es unterschiedliche Anleitungen zur Mediation und Kontemplation.”) the check works fine and the error that only can be found by ngram is highlighted.

If I enter English text, the server crashes (this does not happen, when I deactivate the ngram test):

java -cp languagetool-server.jar org.languagetool.server.HTTPServer --port 8081 --allow-origin '*' --public --config server.properties

2019-07-30 14:40:53 +0000 Not setting up database access, dbDriver is not configured
2019-07-30 14:40:53 +0000 WARNING: running in HTTP mode, consider using org.languagetool.server.HTTPSServer for encrypted connections
2019-07-30 14:40:53 +0000 WARNING: running in public mode, LanguageTool API can be accessed without restrictions!
2019-07-30 14:40:54 +0000 Setting up thread pool with 10 threads
2019-07-30 14:40:54 +0000 Starting LanguageTool 4.6 (build date: 2019-06-26 07:28, fe77e85) server on http://localhost:8081
2019-07-30 14:40:54 +0000 Server started
Warning: At the moment, your platform (Windows) is not supported by the official XGBoost maven package; ML-based suggestion reordering is disabled.
Warning: At the moment, your platform (Windows) is not supported by the official XGBoost maven package; ML-based suggestion reordering is disabled.
java.lang.OutOfMemoryError: Java heap space
at org.apache.lucene.util.fst.FST.(FST.java:387)
at org.apache.lucene.util.fst.FST.(FST.java:313)
at org.apache.lucene.codecs.blocktree.FieldReader.(FieldReader.java:91)
at org.apache.lucene.codecs.blocktree.BlockTreeTermsReader.(BlockTreeTermsReader.java:231)
at org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.fieldsProducer(Lucene50PostingsFormat.java:446)
at org.apache.lucene.codecs.perfield.PerFieldPostingsFormat$FieldsReader.(PerFieldPostingsFormat.java:261)
at org.apache.lucene.codecs.perfield.PerFieldPostingsFormat.fieldsProducer(PerFieldPostingsFormat.java:341)
at org.apache.lucene.index.SegmentCoreReaders.(SegmentCoreReaders.java:104)
at org.apache.lucene.index.SegmentReader.(SegmentReader.java:65)
at org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:58)
at org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:50)
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:731)
at org.apache.lucene.index.StandardDirectoryReader.open(StandardDirectoryReader.java:50)
at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:63)
at org.languagetool.languagemodel.LuceneSingleIndexLanguageModel$LuceneSearcher.(LuceneSingleIndexLanguageModel.java:242)
at org.languagetool.languagemodel.LuceneSingleIndexLanguageModel$LuceneSearcher.(LuceneSingleIndexLanguageModel.java:230)
at org.languagetool.languagemodel.LuceneSingleIndexLanguageModel.getCachedLuceneSearcher(LuceneSingleIndexLanguageModel.java:183)
at org.languagetool.languagemodel.LuceneSingleIndexLanguageModel.addIndex(LuceneSingleIndexLanguageModel.java:119)
at org.languagetool.languagemodel.LuceneSingleIndexLanguageModel.(LuceneSingleIndexLanguageModel.java:95)
at org.languagetool.languagemodel.LuceneLanguageModel.(LuceneLanguageModel.java:65)
at org.languagetool.language.English.getLanguageModel(English.java:168)
at org.languagetool.JLanguageTool.activateLanguageModelRules(JLanguageTool.java:487)
at org.languagetool.server.Pipeline.activateLanguageModelRules(Pipeline.java:129)
at org.languagetool.server.PipelinePool.createPipeline(PipelinePool.java:192)
at org.languagetool.server.PipelinePool.getPipeline(PipelinePool.java:169)
at org.languagetool.server.TextChecker.getRuleMatches(TextChecker.java:482)
at org.languagetool.server.TextChecker.access$000(TextChecker.java:53)
at org.languagetool.server.TextChecker$1.call(TextChecker.java:312)
at org.languagetool.server.TextChecker$1.call(TextChecker.java:305)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

You need to start with more memory, e.g. add -Xmx2500m as another parameter.

Thanks @dnaber. First this did not fix my problem. I then found out, that I had installed a 32bit Java version, not a 64 bit version. Now everything works fine. Thanks.