Skip to content

Failed refactors (due to rope errors) leave zombie processes #2374

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

Closed
mawright opened this issue Aug 10, 2018 · 2 comments
Closed

Failed refactors (due to rope errors) leave zombie processes #2374

mawright opened this issue Aug 10, 2018 · 2 comments
Labels
area-editor-* User-facing catch-all area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug

Comments

@mawright
Copy link

mawright commented Aug 10, 2018

Environment data

  • VS Code version: 1.25.1
  • Extension version (available under the Extensions sidebar): 2018.7.1
  • OS and version: Ubuntu 16.04
  • Python version (& distribution if applicable, e.g. Anaconda): Anaconda 3.6.6
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions: rope managed by conda, version 0.10.7

Actual behavior

When refactors fail due to rope errors (as has been documented in other issues), the process of a Python call to refactor.py does not exit.

Expected behavior

Failed refactors should have the process exit nicely.

Steps to reproduce:

  1. I used this case, based on someone else's issue reporting refactoring failing:
class MyClass():
    def __init__(self, A):
        self.A = A

    def bb(self, b):
        self.b = b
        pass

    def CC(self):
        pass
  1. Trying to refactor-rename b in self.b fails (stacktrace seen in the output log below).
  2. Check code --status in the terminal and see that the refactoring process calls did not exit: (PIDs 4077 and 4078)
matt@Rocko:~$ code --status

Version:          Code 1.25.1 (1dfc5e557209371715f655691b1235b6b26a06be, 2018-07-11T15:40:20.190Z)
OS Version:       Linux x64 4.4.0-131-generic
CPUs:             Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz (8 x 2398)
Memory (System):  7.68GB (0.36GB free)
Load (avg):       1, 1, 1
VM:               0%
Screen Reader:    no
Process Argv:     /usr/share/code/code --unity-launch
GPU Status:       2d_canvas:                    enabled
                  flash_3d:                     enabled
                  flash_stage3d:                enabled
                  flash_stage3d_baseline:       enabled
                  gpu_compositing:              enabled
                  multiple_raster_threads:      enabled_on
                  native_gpu_memory_buffers:    disabled_software
                  rasterization:                disabled_software
                  video_decode:                 unavailable_software
                  video_encode:                 enabled
                  vpx_decode:                   unavailable_software
                  webgl:                        enabled
                  webgl2:                       enabled

CPU %	Mem MB	   PID	Process
    0	   110	  3739	code main
    0	    24	  3741	   zygote
    0	   244	  3787	     window (refactor.py - test - Visual Studio Code)
    0	   173	  3863	       extensionHost
    0	    71	  3959	         electron_node server.js 
    0	    16	  4015	         /home/matt/anaconda3/envs/learn/bin/python completion.py
    0	    16	  4036	           /usr/bin/python3.5 /home/matt/.vscode/extensions/ms-python.python-2018.7.1/pythonFiles/jedi/evaluate/compiled/subprocess/__main__.py /home/matt/.vscode/extensions/ms-python.python-2018.7.1/pythonFiles
    0	    16	  4077	         /home/matt/anaconda3/envs/learn/bin/python refactor.py /home/matt/Code/test
    0	    16	  4078	         /home/matt/anaconda3/envs/learn/bin/python refactor.py /home/matt/Code/test
    0	    55	  3866	       watcherService
    0	    47	  3931	       searchService
    0	   110	  3898	     shared-process
    0	   205	  4124	     shared-process
    0	    94	  3774	   gpu-process

Workspace Stats: 
|  Window (refactor.py - test - Visual Studio Code)
|    Folder (test): 126 files
|      File types: txt(111) py(4) properties(2) properties~(2) xml~(1) xml(1)
|                  pyc(1) md(1)
|      Conf files:

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Starting Jedi Python language engine.
##########Linting Output - pylint##########

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

Refactor failed. expected string or bytes-like object
[<FrameSummary file refactor.py, line 294 in watch>, <FrameSummary file refactor.py, line 275 in _process_request>, <FrameSummary file refactor.py, line 206 in _rename>, <FrameSummary file refactor.py, line 117 in refactor>, <FrameSummary file refactor.py, line 138 in onRefactor>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/refactor/rename.py, line 25 in __init__>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/evaluate.py, line 19 in eval_location2>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/evaluate.py, line 113 in get_primary_and_pyname_at>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/evaluate.py, line 47 in eval_str2>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/evaluate.py, line 32 in eval_node2>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/ast.py, line 41 in walk>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/ast.py, line 41 in walk>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/ast.py, line 39 in walk>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/evaluate.py, line 155 in _Attribute>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/pynamesdef.py, line 42 in get_object>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/pyobjectsdef.py, line 69 in get_parameter>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 29 in newfunc>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/pynames.py, line 188 in get>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/pyobjectsdef.py, line 40 in _infer_parameters>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 41 in newfunc>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/oi/soi.py, line 47 in infer_parameter_objects>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/oi/soi.py, line 130 in _parameter_objects>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/oi/type_hinting/providers/inheritance.py, line 21 in __call__>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/oi/type_hinting/providers/composite.py, line 19 in __call__>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/oi/type_hinting/providers/docstrings.py, line 46 in __call__>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/oi/type_hinting/providers/numpydocstrings.py, line 20 in __call__>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/numpydoc/docscrape.py, line 138 in __init__>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/textwrap.py, line 430 in dedent>]
Refactor failed. expected string or bytes-like object
[<FrameSummary file refactor.py, line 294 in watch>, <FrameSummary file refactor.py, line 275 in _process_request>, <FrameSummary file refactor.py, line 206 in _rename>, <FrameSummary file refactor.py, line 117 in refactor>, <FrameSummary file refactor.py, line 138 in onRefactor>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/refactor/rename.py, line 25 in __init__>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/evaluate.py, line 19 in eval_location2>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/evaluate.py, line 113 in get_primary_and_pyname_at>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/evaluate.py, line 47 in eval_str2>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/evaluate.py, line 32 in eval_node2>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/ast.py, line 41 in walk>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/ast.py, line 41 in walk>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/ast.py, line 39 in walk>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/evaluate.py, line 155 in _Attribute>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/pynamesdef.py, line 42 in get_object>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/pyobjectsdef.py, line 69 in get_parameter>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 29 in newfunc>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/pynames.py, line 188 in get>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/pyobjectsdef.py, line 40 in _infer_parameters>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/utils/__init__.py, line 41 in newfunc>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/oi/soi.py, line 47 in infer_parameter_objects>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/oi/soi.py, line 130 in _parameter_objects>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/oi/type_hinting/providers/inheritance.py, line 21 in __call__>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/oi/type_hinting/providers/composite.py, line 19 in __call__>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/oi/type_hinting/providers/docstrings.py, line 46 in __call__>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/oi/type_hinting/providers/numpydocstrings.py, line 20 in __call__>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/numpydoc/docscrape.py, line 138 in __init__>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/textwrap.py, line 430 in dedent>]

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:1375  INFO no standard startup: panel is active
/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:4103 Overwriting grammar scope name to file mapping for scope source.python.
Old grammar file: file:///usr/share/code/resources/app/extensions/python/syntaxes/MagicPython.tmLanguage.json.
New grammar file: file:///home/matt/.vscode/extensions/magicstack.magicpython-1.0.12/grammars/MagicPython.tmLanguage
e.register @ /usr/share/code/resources/app/out/vs/workbench/workbench.main.js:4103
/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:270 [Extension Host] vscode-icons is active!
2/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:2364 Refactor failed. expected string or bytes-like object [<FrameSummary file refactor.py, line 294 in watch>, <FrameSummary file refactor.py, line 275 in _process_request>, <FrameSummary file refactor.py, line 206 in _rename>, <FrameSummary file refactor.py, line 117 in refactor>, <FrameSummary file refactor.py, line 138 in onRefactor>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/refactor/rename.py, line 25 in __init__>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/evaluate.py, line 19 in eval_location2>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/evaluate.py, line 113 in get_primary_and_pyname_at>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/evaluate.py, line 47 in eval_str2>, <FrameSummary file /home/matt/anaconda3/envs/learn/lib/python3.6/site-packages/rope/base/evaluate.py, line 32 in eval_node2>, <FrameSummary f...
e.onDidNotificationChange @ /usr/share/code/resources/app/out/vs/workbench/workbench.main.js:2364
@d3r3kk d3r3kk added bug Issue identified by VS Code Team member as probable bug feature-refactoring labels Aug 10, 2018
@brettcannon brettcannon added needs PR important Issue identified as high-priority and removed needs verification bug Issue identified by VS Code Team member as probable bug labels Aug 14, 2018
@qubitron qubitron removed the important Issue identified as high-priority label Oct 31, 2018
@brettcannon brettcannon added the bug Issue identified by VS Code Team member as probable bug label Jun 3, 2019
@kimadeline
Copy link

Still happening in 2019.9.34911 using a virtual environment created with venv

@kimadeline kimadeline removed their assignment Sep 12, 2019
@gramster gramster added the area-editor-* User-facing catch-all label Oct 10, 2019
@brettcannon brettcannon added area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. and removed feature-refactoring labels Apr 9, 2020
@karthiknadig
Copy link
Member

This should be addressed by #10440

@ghost ghost removed the needs PR label Aug 4, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-editor-* User-facing catch-all area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

7 participants