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

A Python background process stays opened after closing Spyder in master #7796

Closed
2 tasks done
jnsebgosselin opened this issue Aug 31, 2018 · 25 comments
Closed
2 tasks done

Comments

@jnsebgosselin
Copy link
Member

Issue Report Checklist

  • Searched the issues page for similar reports
  • Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

After opening Spyder in master with the bootstrap.py or from the Anaconda navigator and closing it, a Python process remains opened in Windows. Introspection becomes broken by this until I close these background processes and restart Spyder. So this is probably related with the problems I reported in Issue #7726.

Note that this is not occurring with the 3.x branch.

image

What steps reproduce the problem?

  1. Open Spyder
  2. Close Spyder

What is the expected output? What do you see instead?

All Python processes started by Spyder should be closed

Versions

  • Spyder version: Spyder 4.0.0.dev0 3465e77
  • Python version: Python 3.6.5 64bits
  • Qt version: Qt 5.9.3
  • PyQt version: PyQt5 5.9.2
  • Operating System name/version: Windows 10

Dependencies

pyflakes >=0.6.0  :  1.6.0 (OK)
pycodestyle >=2.3 :  2.3.1 (OK)
pygments >=2.0    :  2.2.0 (OK)
sphinx >=0.6.6    :  1.7.1 (OK)
rope >=0.9.4      :  0.10.7 (OK)
jedi >=0.11.0     :  0.12.1 (OK)
nbconvert >=4.0   :  5.3.1 (OK)
pandas >=0.13.1   :  0.22.0 (OK)
numpy >=1.7       :  1.13.0 (OK)
sympy >=0.7.3     :  1.1.1 (OK)
cython >=0.21     :  0.27.3 (OK)
qtconsole >=4.2.0 :  4.3.1 (OK)
IPython >=4.0     :  6.2.1 (OK)
matplotlib >=2.0.0:  2.2.0 (OK)
pylint >=0.25     :  1.8.3 (OK)
@jnsebgosselin jnsebgosselin changed the title A Python background processes stays opened after closing Spyder in master A Python background process stays opened after closing Spyder in master Aug 31, 2018
@ccordoba12 ccordoba12 added this to the v4.0beta2 milestone Aug 31, 2018
@ccordoba12
Copy link
Member

This is probably related to the fact that the old code completion architecture has not been removed yet. It's in our TODO list: #7724.

@jnsebgosselin
Copy link
Member Author

I just want to confirm that without killing these background processes in Windows, introspection stop working.

I wish I could help more, but I do not understand enough what is going on.

@jnsebgosselin
Copy link
Member Author

@ccordoba12 Note that, this does not occur when running in debug mode.

I'm under the impression that the LSP client do not have time to close correctly when Spyder is not run in debug mode.

image

@jnsebgosselin
Copy link
Member Author

@ccordoba12 This is still occurring even after the removal of the old architecture. But when running in debug, it is not. Sometimes, the LSP Client takes a long time to close. Like 15-20 sec.

@ccordoba12
Copy link
Member

This seems a hard bug to solve. @jnsebgosselin, do you think we could leave this for beta3? I mean, it's definitely annoying but not critical.

@jnsebgosselin
Copy link
Member Author

@ccordoba12 This problem is not happening if I run Spyder from my Anaconda env with pyls==0.19.

@ccordoba12
Copy link
Member

Ok, so the problem is with the latest pyls. Thanks for confirming it.

@jnsebgosselin
Copy link
Member Author

Ok, so the problem is with the latest pyls. Thanks for confirming it.

With the latest pyls (>0.19), introspection simply doesn't work at all or make Spyder crash, whether in pip or Anaconda..

The problem I've reported here happens on Windows with pyls==0.19, but I think this is an issue that is specific to my pip install. The problem doesn't occur with Anaconda also using pyls==0.19.

@CAM-Gerlach
Copy link
Member

The problem I've reported here happens on Windows with pyls==0.19, but I think this is an issue that is specific to my pip install. The problem doesn't occur with Anaconda also using pyls==0.19.

As part of #8153 I believe I likely reproduced the same problem, since I was upgrading and downgrading with pip, got errors related to pyls.exe being in use, and with all other variables (other than background processes, which I speculated were the cause but wasn't able to isolate a specific one since I had so many Spyders and Pythons open at the time) being equal it would not work after some of the installs downgrades, but when I came back and tried a day later it did. It occurred on 0.19 and 0.20, the two versions I tested.

@ccordoba12
Copy link
Member

@dalthviz, are you able to reproduce this with PyLS 0.19?

@CAM-Gerlach
Copy link
Member

I have been able to, although it doesn't always make completion stop working at least in my limited testing.

@ccordoba12
Copy link
Member

Ok, thanks! I'm moving this to beta3 because I think we need to address this in PyLS itself.

@ccordoba12 ccordoba12 modified the milestones: v4.0beta2, v4.0beta3 Dec 10, 2018
@stonebig
Copy link
Contributor

today, I don't see this, using PyLS-0.22.0 and spyder master of 2 days ago.

@CAM-Gerlach
Copy link
Member

I haven't really seen this either recently that I recall over the past few weeks with 0.21.

@ccordoba12
Copy link
Member

Ok, that's good to know. @jnsebgosselin?

@jnsebgosselin
Copy link
Member Author

Ok, that's good to know. @jnsebgosselin?

This has stopped to be a problem for me the day I started to use conda instead of pip to setup my Python environments. So, for me, it is not a problem anymore, but I don't know exactly what fixed what.

@ccordoba12 ccordoba12 removed this from the v4.0beta3 milestone Jan 29, 2019
@ccordoba12
Copy link
Member

Ok, thanks for the confirmation. Let's close this one for the time being.

@CAM-Gerlach
Copy link
Member

For the record, I've used pip inside a conda environment for installing and updating PyLS throughout.

@pbower
Copy link

pbower commented Oct 23, 2019

All - this still happens. I am using Spyder 4 and after closing had 6 python.exe processes open (that appeared to have each accumulated after separate Spyder instances).

@CAM-Gerlach
Copy link
Member

@pbower Which Spyder 4 beta or dev version are you using? What is your OS and PyLS versions and how did you install them (pip, conda-forge, spyder-ide channel, etc))?

As of Beta 6 (and consistently in previous betas since this issue was first reported), I indeed have had 3 processes stick around indefinitely each time after Spyder crashes, but I haven't noticed it happen if Spyder exits cleanly. The three are Spyder's LSP transport (I assume the client), the PyLS server, and the Jedi subprocess of the server, and depending on use occupy anywhere from 100 MB to well over half a GB of RAM per triplet.

I cannot be 100% sure this occurs on the latest Beta 7 as I'm not sure if it has crashed yet, but next time Spyder crashes I will check. From what I can tell, it looks like the Beta 6 processes are running under the window-mode pythonw while the Beta 7 processes appear to be running under the standard command-line python. I'm running PyLS 0.28.3 with all deps from spyder-ide, no pip installs like before.

@pbower
Copy link

pbower commented Oct 24, 2019 via email

@pbower
Copy link

pbower commented Oct 24, 2019 via email

@CAM-Gerlach
Copy link
Member

Yes, completely normal, like any modern multiprocess application and this is A Good Thing™. Looking at them in a task manager you can figure out what each is: Python launcher, main Spyder process, LSP server, LSP client, Jedi completion engine, and the IPython kernel that powers the default Console. An additional Python process will be launched for each kernel you start, and there are usually at least a few QtWebEngine processes that render the documentation in the help pane for the Editor and each Console.

@pbower
Copy link

pbower commented Oct 24, 2019 via email

@ccordoba12
Copy link
Member

I indeed have had 3 processes stick around indefinitely each time after Spyder crashes

For the record, this is being worked on in PR #10111.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants