Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle error conditions when checking memory usage of jedi language server process #927

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/client/providers/jediProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,11 @@ export class JediProxy implements vscode.Disposable {
return;
}
pidusage.stat(this.proc.pid, async (err, result) => {
if (err) {
return console.error('Python Extension: (pidusage)', err);
}
const limit = Math.min(Math.max(this.pythonSettings.jediMemoryLimit, 1024), 8192);
if (result.memory > limit * 1024 * 1024) {
if (result && result.memory > limit * 1024 * 1024) {
this.logger.logWarning(`IntelliSense process memory consumption exceeded limit of ${limit} MB and process will be restarted.\nThe limit is controlled by the 'python.jediMemoryLimit' setting.`);
await this.restartLanguageServer();
}
Expand Down