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

Python 2.7 crashes on extension load, and various features such as linting fail #13463

Closed
bbappserver opened this issue Aug 17, 2020 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@bbappserver
Copy link

Issue Type: Bug

When the python extensions load, python 2.7 it immediately raises SIGABRT, and various features such as linting fail to work. The documentation shows that the system install of python is not supported for various things and I wonder if this is perhaps related. Ideally none of the extensions should be using python2.7 as it is EOL and I have selected 3.7 as my interpreter, so I know it isn't my code that is crashing.

Extension version: 2020.8.101144
VS Code version: Code 1.48.0 (db40434f562994116e5b21c24015a2e40b2504e6, 2020-08-13T08:03:27.059Z)
OS version: Darwin x64 17.7.0

System Info
Item Value
CPUs Intel(R) Core(TM) i5-5287U CPU @ 2.90GHz (4 x 2900)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
Load (avg) 15, 12, 12
Memory (System) 16.00GB (0.17GB free)
Process Argv
Screen Reader no
VM 0%
@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Aug 17, 2020
@bbappserver
Copy link
Author

> python2
Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 19 2020, 20:48:48) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information
>

I can run the interpreter just fine and have few installed packages, so VSCode must be doing something weird.

> python2 -mpip list
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Package       Version    
------------- -----------
-             ndocfilters
-andocfilters 1.4.2      
-ySQL-python  1.2.5      
pip           20.0.2     
setuptools    41.2.0     
wheel         0.29.0     

@karthiknadig karthiknadig added the bug Issue identified by VS Code Team member as probable bug label Aug 17, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Aug 17, 2020
@bbappserver
Copy link
Author

Process:               python2.7 [22071]
Path:                  /Users/USER/*/python2.7
Identifier:            python2.7
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        Code Helper (Renderer) [21950]
Responsible:           Electron [72570]
User ID:               507

Date/Time:             2020-07-21 15:04:37.523 -0700
OS Version:            Mac OS X 10.13.6 (17G13035)
Report Version:        12
Anonymous UUID:        B57F292F-980F-BDD0-22C6-7321EAE5B44C


Time Awake Since Boot: 800000 seconds

System Integrity Protection: enabled

Crashed Thread:        0

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Application Specific Information:
dyld: launch, loading dependent libraries

Thread 0 Crashed:
0   dyld                          	0x0000000103aeb256 __abort_with_payload + 10
1   dyld                          	0x0000000103aeabc8 abort_with_payload_wrapper_internal + 89
2   dyld                          	0x0000000103aeabf5 abort_with_payload + 9
3   dyld                          	0x0000000103abe482 dyld::halt(char const*) + 354
4   dyld                          	0x0000000103ac1533 dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 8004
5   dyld                          	0x0000000103abb3d4 dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*, unsigned long*) + 453
6   dyld                          	0x0000000103abb1d2 _dyld_start + 54

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000002000209  rbx: 0x0000000000000001  rcx: 0x00007ffeeedc8648  rdx: 0x00007ffeeedc8ac0
  rdi: 0x0000000000000006  rsi: 0x0000000000000001  rbp: 0x00007ffeeedc86a0  rsp: 0x00007ffeeedc8648
   r8: 0x00007ffeeedc86c0   r9: 0x0000000000000000  r10: 0x0000000000000064  r11: 0x0000000000000246
  r12: 0x0000000000000064  r13: 0x00007ffeeedc8ac0  r14: 0x0000000000000006  r15: 0x0000000000000000
  rip: 0x0000000103aeb256  rfl: 0x0000000000000246  cr2: 0x0000000103b3bfe0
  
Logical CPU:     0
Error Code:      0x02000209
Trap Number:     133


Binary Images:
       0x100e35000 -        0x100e36fff +python2.7 (0) <9CD143CC-C6A2-345F-B19A-61366A62A977> /Users/USER/*/python2.7
       0x103aba000 -        0x103b04adf  dyld (551.5) <CB9BFB56-4511-36F1-A546-891FF770C01C> /usr/lib/dyld

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 77148632
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=420K resident=0K(0%) swapped_out_or_unallocated=420K(100%)
Writable regions: Total=8404K written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=8404K(100%)
 
                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
STACK GUARD                       56.0M        2 
Stack                             8192K        3 
__DATA                             228K        5 
__LINKEDIT                         112K        3 
__TEXT                             308K        3 
shared memory                        8K        3 
===========                     =======  ======= 
TOTAL                             64.6M       13 

@karrtikr
Copy link

@bbappserver We just want to quickly acknowledge that we have received the issue and will be looking into it soon.

@karrtikr
Copy link

@bbappserver Please provide the logs as mentioned in the issue template which contains the command the extension runs

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

XXX

When discovering interpreters, extension may run things that are on your PATH so please double check that python2 is not on your PATH environment variable if you don't want us to run it. Btw, how do you know if it's python2 that's raising the error?

@karrtikr karrtikr added the info-needed Issue requires more information from poster label Aug 20, 2020
@bbappserver
Copy link
Author

Ah thank you based on the logs, the problem appears to have been caused by an old project with a faulty virtual environment after an update.
I'm not sure if subsequent problems were related. I will attempt to remove the faulty environment and see if the extensions start behaving. I suspect the python inspection tools need to run in the venv of the thing they are inspecting in order that the libraries are correct, so VS code might not be able to work around this. But it's weird that it's being caused by a venv of a project which is not even open.
pythontraceabort.log


Error 2020-08-22 18:42:28: Failed to get interpreter information for '/Users/someuser/.virtualenvs/someproject/bin/python2' [Error: Command failed: "/Users/someuser/.virtualenvs/someproject/bin/python2" "/Users/someuser/.vscode/extensions/ms-python.python-2020.8.101144/pythonFiles/pyvsc-run-isolated.py" "/Users/someuser/.vscode/extensions/ms-python.python-2020.8.101144/pythonFiles/interpreterInfo.py"
dyld: Library not loaded: @executable_path/../.Python
  Referenced from: /Users/someuser/.virtualenvs/someproject/bin/python2
  Reason: image not found

	at ChildProcess.exithandler (child_process.js:308:12)
	at ChildProcess.emit (events.js:203:13)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:430:11)
	at Socket.emit (events.js:203:13)
	at Pipe.<anonymous> (net.js:588:12)] {
  killed: false,
  code: null,
  signal: 'SIGABRT',
  cmd: '"/Users/someuser/.virtualenvs/someproject/bin/python2" "/Users/someuser/.vscode/extensions/ms-python.python-2020.8.101144/pythonFiles/pyvsc-run-isolated.py" "/Users/someuser/.vscode/extensions/ms-python.python-2020.8.101144/pythonFiles/interpreterInfo.py"'
}
Error 2020-08-22 18:42:28: Failed to get interpreter information for '/Users/someuser/.virtualenvs/someproject/bin/python' [Error: Command failed: "/Users/someuser/.virtualenvs/someproject/bin/python" "/Users/someuser/.vscode/extensions/ms-python.python-2020.8.101144/pythonFiles/pyvsc-run-isolated.py" "/Users/someuser/.vscode/extensions/ms-python.python-2020.8.101144/pythonFiles/interpreterInfo.py"
dyld: Library not loaded: @executable_path/../.Python
  Referenced from: /Users/someuser/.virtualenvs/someproject/bin/python
  Reason: image not found

	at ChildProcess.exithandler (child_process.js:308:12)
	at ChildProcess.emit (events.js:203:13)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:430:11)
	at Socket.emit (events.js:203:13)
	at Pipe.<anonymous> (net.js:588:12)] {
  killed: false,
  code: null,
  signal: 'SIGABRT',
  cmd: '"/Users/someuser/.virtualenvs/someproject/bin/python" "/Users/someuser/.vscode/extensions/ms-python.python-2020.8.101144/pythonFiles/pyvsc-run-isolated.py" "/Users/someuser/.vscode/extensions/ms-python.python-2020.8.101144/pythonFiles/interpreterInfo.py"'
}

@bbappserver
Copy link
Author

bbappserver commented Aug 23, 2020

@karrtikr
Yup removing the faulty environment seems to have corrected the issue, but I'll let you guys close the issue in case you think VSCode should be able to report and correct that kind of error.

On a related note, once it ran successfully it behaved correctly but the language server crashed soon after.
VSCode appears to have recovered successfully from this, but here is the log.
Microsoft Language server.log

@karrtikr
Copy link

You're spot on 🙂 actually we look into your filesystem for discovering interpreters, that includes the .virtualenvs directory. The discovered interpreters are the one which appear in the dropdown list when you click Select interpreter. In order to fetch version and other details, we run them, which is what was happening.

We're working on getting such details without having to run the interpreter. All of this & more with #12020.

@ghost ghost removed the triage label Aug 24, 2020
@karrtikr
Copy link

As the LS problem is unrelated, I recommend opening a new issue if you still face it.

@karrtikr karrtikr reopened this Aug 24, 2020
@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Aug 24, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Aug 24, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants