microsoft / debugpy

An implementation of the Debug Adapter Protocol for Python
https://pypi.org/project/debugpy/
Other
1.83k stars 136 forks source link

Terminal cuts off long strings when debugging #1285

Open boppreh opened 1 year ago

boppreh commented 1 year ago

Type: Bug

Behaviour

Steps to reproduce:

  1. Create a Python file with the following code that prints a 1MB string made of '0123456789' repeated 100.000 times:
print('\n'.join(['0123456789' for i in range(100_000)]))
print('finished')
  1. Run with "Python: Debug Python file".

Note it only happens with "Debug Python file", not "Run Python file in Terminal".

Expected

The last lines in Terminal are

[...]
0123456789
0123456789
0123456789
finished

Observed

The last lines in Terminal are

[...]
0123456789
0123456789
01
finished

showing that the string got cut at some point. Note that the program continued running.

Diagnostic data

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

``` Experiment 'pythonPromptNewFormatterExtcf' is active Experiment 'pythonPromptNewToolsExt' is active > conda info --json Python interpreter path: C:\Python311\python.exe > C:\Python311\python.exe -I ~\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\interpreterInfo.py > ~\.conda\Scripts\conda.exe info --json > ~\anaconda3\envs\ldm\Scripts\conda.exe info --json > C:\Python310\python.exe -I ~\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\interpreterInfo.py > "C:\Program Files\Python39\python.exe" -I ~\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\interpreterInfo.py [ERROR 2023-4-2 21:44:36.492]: Error: Command failed: "C:\Program Files\Python39\python.exe" -I c:\Users\BoppreH\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\get_output_via_markers.py c:\Users\BoppreH\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\interpreterInfo.py The system cannot find the path specified. at ChildProcess.exithandler (node:child_process:408:12) at ChildProcess.emit (node:events:526:28) at maybeClose (node:internal/child_process:1092:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) { killed: false, code: 1, signal: null, cmd: '"C:\\Program Files\\Python39\\python.exe" -I c:\\Users\\BoppreH\\.vscode\\extensions\\ms-python.python-2023.6.1\\pythonFiles\\get_output_via_markers.py c:\\Users\\BoppreH\\.vscode\\extensions\\ms-python.python-2023.6.1\\pythonFiles\\interpreterInfo.py' } Starting Pylance language server. > "C:\Program Files\Python39\python.exe" -I ~\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\interpreterInfo.py [ERROR 2023-4-2 21:44:38.522]: Error: Command failed: "C:\Program Files\Python39\python.exe" -I c:\Users\BoppreH\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\get_output_via_markers.py c:\Users\BoppreH\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\interpreterInfo.py The system cannot find the path specified. at ChildProcess.exithandler (node:child_process:408:12) at ChildProcess.emit (node:events:526:28) at maybeClose (node:internal/child_process:1092:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) { killed: false, code: 1, signal: null, cmd: '"C:\\Program Files\\Python39\\python.exe" -I c:\\Users\\BoppreH\\.vscode\\extensions\\ms-python.python-2023.6.1\\pythonFiles\\get_output_via_markers.py c:\\Users\\BoppreH\\.vscode\\extensions\\ms-python.python-2023.6.1\\pythonFiles\\interpreterInfo.py' } DAP Server launched with command: C:\Python311\python.exe c:\Users\BoppreH\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\lib\python\debugpy\adapter Send text to terminal: & 'C:\Python311\python.exe' 'c:\Users\BoppreH\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '1090' '--' 'C:\Users\BoppreH\Desktop\source\lang-2019-06\bug.py' ```

User Settings

``` languageServer: "Pylance" ```

Extension version: 2023.6.1 VS Code version: Code 1.77.3 (704ed70d4fd1c6bd6342c436f1ede30d1cff4710, 2023-04-12T09:16:02.548Z) OS version: Windows_NT x64 10.0.19045 Modes: Sandboxed: Yes

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 5 3600 6-Core Processor (12 x 3600)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|undefined| |Memory (System)|31.95GB (20.78GB free)| |Process Argv|--crash-reporter-id 36b87417-7c27-4264-9aea-a5731eebb150| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492:30256859 vslsvsres303:30308271 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 pythondataviewer:30285071 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593cf:30376535 pythonvs932:30410667 cppdebug:30492333 vsclangdf:30486550 c4g48928:30535728 dsvsc012cf:30540253 pynewext54:30695312 azure-dev_surveyone:30548225 nodejswelcome1:30587005 2e4cg342:30602488 pyind779:30671433 f6dab269:30613381 pythonsymbol12:30671437 2i9eh265:30646982 6233i204:30730053 vsctsb:30705553 azdwalk:30721579 pythonms35:30701012 pythonfmttextcf:30716743 pythonclientmvcf:30725893 fixhidewlkth:30730051 hidesbindicator:30730055 ```
boppreh commented 1 year ago

Note that this was initially raised as an issue in VS Code: https://github.com/microsoft/vscode/issues/181182 , and I was told to track it here instead.