Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Conversation

@AlexanderSher
Copy link
Contributor

Leak has been happening because of the intermediate session has been marked completed, which could trigger a new session while the old one isn't completed. To avoid this, sessions don't reference one another in a form of linked list. Instead, PythonAnalyzer holds reference to the currently-running session and updates the reference for the next session if new request comes before current session is completed.

}


var cancellationToken = _cts.Token;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes ODE in:

Unhandled Exception: System.ObjectDisposedException: The CancellationTokenSource has been disposed.
 at System.Threading.CancellationTokenSource.ThrowObjectDisposedException()
 at System.Threading.CancellationTokenSource.get_Token()
 at Microsoft.Python.Analysis.Analyzer.PythonAnalyzerSession.<>c__DisplayClass29_0.<StartAnalysis>b__0() in F:\PLS\src\Analysis\Ast\Impl\Analyzer\PythonAnalyzerSession.cs:line 280
 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
 at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
 at Microsoft.Python.Core.TaskExtensions.<>c.<DoNotWaitThreadContinuation>b__4_0(Object s) in F:\PLS\src\Core\Impl\Extensions\TaskExtensions.cs:line 79
 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
 at System.Threading.ThreadPoolWorkQueue.Dispatch()

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

master peaks at some 4GB with tensorflow, and sometimes drops to ~1.3GB at the end, now it peaks at completion at ~1.3GB at the end. Night and day.

@AlexanderSher AlexanderSher merged commit abd4254 into microsoft:master Apr 2, 2019
@jakebailey jakebailey mentioned this pull request Apr 2, 2019
@AlexanderSher AlexanderSher deleted the FixLeakingSessions branch April 10, 2019 21:52
jakebailey pushed a commit to jakebailey/python-language-server that referenced this pull request Nov 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants