vscode-ltex: Constant high CPU usage
Describe the bug ltex-server hangs in the background. I tried to debug it a bit using YourKit Profiler.
Potential deadlock: frozen threads found
It seems that the following threads have not changed their stack for more than 10 seconds. These threads are possibly (but not necessarily!) in a deadlock or hung.
±-------------------------------------------------------------------------------------------------------------+ | Name | ±-------------------------------------------------------------------------------------------------------------+ | ±–main Frozen for at least 17s <Ignore a false positive> | | | | | ±–jdk.internal.misc.Unsafe.park(boolean, long) Unsafe.java (native) | | | | | ±–java.util.concurrent.locks.LockSupport.park(Object) LockSupport.java:211 | | | | | ±–java.util.concurrent.FutureTask.awaitDone(boolean, long) FutureTask.java:447 | | | | | ±–java.util.concurrent.FutureTask.get() FutureTask.java:190 | | | | | ±–org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor$1.get() ConcurrentMessageProcessor.java:54 | | | | | ±–org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor$1.get() ConcurrentMessageProcessor.java:50 | | | | | ±–LtexLanguageServerLauncher.launch(InputStream, OutputStream) LtexLanguageServerLauncher.java:40 | | | | | ±–LtexLanguageServerLauncher.main(String[]) LtexLanguageServerLauncher.java:69 | ±-------------------------------------------------------------------------------------------------------------+
But I don’t think this is actually a classical deadlock, but it looks more like an infinite loop.

Details can be found in the following snapshots (remove txt, and open with YourKit Profiler). The second one was taken a few mins after the first one. LtexLanguageServerLauncher-2020-10-04.snapshot.txt
LtexLanguageServerLauncher-2020-10-04(1).snapshot.txt
Steps to reproduce Don’t know 😦
Expected behavior A clear and concise description of what you expected to happen.
LTeX configuration
Please paste all configuration settings starting with ltex. from your settings.json. You can help us by temporarily removing some irrelevant settings from your settings.json and see if the bug still occurs.
{
"enabled": [
"markdown",
"latex",
"rsweave"
],
"language": "en-US",
"dictionary": {},
"workspaceDictionary": {},
"workspaceFolderDictionary": {},
"disabledRules": {
"en-US": [
"MORFOLOGIK_RULE_EN_US",
"SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA"
]
},
"workspaceDisabledRules": {},
"workspaceFolderDisabledRules": {},
"enabledRules": {},
"workspaceEnabledRules": {},
"workspaceFolderEnabledRules": {},
"ltex-ls": {
"path": "",
"languageToolHttpServerUri": ""
},
"java": {
"path": "",
"initialHeapSize": 64,
"maximumHeapSize": 512
},
"commands": {
"ignore": [],
"dummy": []
},
"environments": {
"ignore": [
"equationcd"
]
},
"markdown": {
"ignore": [
"CodeBlock",
"FencedCodeBlock",
"IndentedCodeBlock"
],
"dummy": [
"AutoLink",
"Code"
]
},
"ignoreRuleInSentence": [],
"configurationTarget": {
"addToDictionary": "workspaceFolder",
"disableRule": "workspaceFolder",
"ignoreRuleInSentence": "workspaceFolder"
},
"additionalRules": {
"motherTongue": "",
"languageModel": "",
"neuralNetworkModel": "",
"word2VecModel": ""
},
"sentenceCacheSize": 2000,
"diagnosticSeverity": "information",
"clearDiagnosticsWhenClosingFile": true,
"trace": {
"server": "off"
}
}
“LTeX Language Server” log file
First, reproduce the bug. Then, go to View → Output and select LTeX Language Server in the drop-down list. Paste this log here:
[... truncated]
INFO: Obtained 1 rule match
Oct 04, 2020 5:52:40 PM org.bsplines.ltexls.DocumentChecker checkAnnotatedTextFragment
INFO: Checking the following text in language 'en-US' via LanguageTool: 'Add bundle version?!'
There are a couple of more of such statements, (that I’m not really comfortable at sharing), all at the same time. I noticed that all of them are contents of \todo{...} commands. Nothing else.
“LTeX Language Client” log file
First, set the ltex.trace.server setting in your settings.json to "verbose". Then, reload the VS Code window and reproduce the bug. Go to View → Output and select LTeX Language Client in the drop-down list. Paste this log here (note: it will contain your checked document):
2020-10-03T20:40:44.590Z Info: Setting LTeX UI language to 'en-us'.
2020-10-03T20:40:44.590Z Info: Loading i18n messages...
2020-10-03T20:40:44.592Z Info: Loading default i18n messages...
2020-10-03T20:40:44.594Z Info:
2020-10-03T20:40:44.595Z Info: ltex.ltex-ls.path not set.
2020-10-03T20:40:44.595Z Info: Searching for ltex-ls in 'c:\Users\Tobi\.vscode\extensions\valentjn.vscode-ltex-7.2.0\lib'...
2020-10-03T20:40:44.596Z Info: ltex-ls found in 'c:\Users\Tobi\.vscode\extensions\valentjn.vscode-ltex-7.2.0\lib\ltex-ls-7.2.0'.
2020-10-03T20:40:44.596Z Info:
2020-10-03T20:40:44.597Z Info: ltex.java.path not set.
2020-10-03T20:40:44.597Z Info: Using ltex-ls from 'c:\Users\Tobi\.vscode\extensions\valentjn.vscode-ltex-7.2.0\lib\ltex-ls-7.2.0'.
2020-10-03T20:40:44.597Z Info: Using Java from PATH or JAVA_HOME (may fail if not installed).
2020-10-03T20:40:44.823Z Info: Testing ltex-ls...
2020-10-03T20:40:44.823Z Info: Command: "c:\\Users\\Tobi\\.vscode\\extensions\\valentjn.vscode-ltex-7.2.0\\lib\\ltex-ls-7.2.0\\bin\\ltex-ls.bat"
2020-10-03T20:40:44.823Z Info: Arguments: ["--version"]
2020-10-03T20:40:44.824Z Info: env['JAVA_HOME']: undefined
2020-10-03T20:40:44.824Z Info: env['JAVA_OPTS']: "-Xms64m -Xmx512m"
2020-10-03T20:40:46.339Z Info: Test successful!
2020-10-03T20:40:46.354Z Info:
2020-10-03T20:40:46.367Z Info: Starting ltex-ls...
2020-10-03T20:40:46.367Z Info: Command: "c:\\Users\\Tobi\\.vscode\\extensions\\valentjn.vscode-ltex-7.2.0\\lib\\ltex-ls-7.2.0\\bin\\ltex-ls.bat"
2020-10-03T20:40:46.367Z Info: Arguments: []
2020-10-03T20:40:46.367Z Info: env['JAVA_HOME']: undefined
2020-10-03T20:40:46.367Z Info: env['JAVA_OPTS']: "-Xms64m -Xmx512m"
2020-10-03T20:40:46.367Z Info:
2020-10-04T15:54:12.996Z Info: Creating bug report...
Version information List here the version information of the relevant software.
- Operating system: Windows_NT (win32), x64, 10.0.19042
- VS Code: 1.49.3
- vscode-ltex: 7.2.0
- ltex-ls: 7.2.0
- Java: 14.0.1
Additional context/information You can add any other context or information about the problem here.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (7 by maintainers)
Commits related to this issue
- Add debug output For valentjn/vscode-ltex#134. — committed to valentjn/ltex-ls by valentjn 4 years ago
- Add debug output For valentjn/vscode-ltex#134. — committed to valentjn/ltex-ls by valentjn 4 years ago
- Don't recheck when generating code actions See valentjn/vscode-ltex#134. — committed to valentjn/ltex-ls by valentjn 4 years ago
- Fix many setting changes cleared sentence cache See valentjn/vscode-ltex#134. — committed to valentjn/ltex-ls by valentjn 4 years ago
- Add debug output For valentjn/vscode-ltex#134. — committed to me-johnomar/ltex-ls by me-johnomar 4 years ago
- Don't recheck when generating code actions See valentjn/vscode-ltex#134. — committed to me-johnomar/ltex-ls by me-johnomar 4 years ago
- Fix many setting changes cleared sentence cache See valentjn/vscode-ltex#134. — committed to me-johnomar/ltex-ls by me-johnomar 4 years ago
Sorry, I lacked the time to beta test before the full release. The provided information might be useful another time 🙂.
I have updated to 8.0.0 today, and after updating the config I can report that the performance issue with the magic comments seems to be gone indeed. Thanks!