You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importasyncioimportconcurrent.futuresimportosdefcpu_bound():
print(os.getpid())
returnsum(i*iforiinrange(10**7))
asyncdefmain():
print(os.getpid())
loop=asyncio.get_event_loop()
# Run in a custom process pool:withconcurrent.futures.ProcessPoolExecutor() aspool:
result=awaitloop.run_in_executor(
pool, cpu_bound)
print('custom process pool', result)
if__name__=='__main__':
loop=asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()
print('done')
Running the code above with the Python: Current File (Integrated Terminal) debugger profile appears to result in a deadlock (no pid is printed from the cpu_bound function). Running that very same code directly with Python 3.6 via the command line works as expected. If the ProcessPoolExecutor is replaced with ThreadPoolExecutor the code appears to run fine using the debugger.
Environment data
VS Code version: 1.32.1
Extension version: 2019.2.5558
OS and version: macOS 10.14.3
Python version (& distribution if applicable, e.g. Anaconda): Anaconda 3.6.7
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
Relevant/affected Python packages and their versions: NA
Expected behaviour
The script runs to completion and prints two pid numbers and the result of the computation:
10385
10386
custom process pool 333333283333335000000
done
Actual behaviour
The script prints the first pid and then pauses until the user manually stops the debugger. Output:
10412
Steps to reproduce:
Setup a basic Python 3.6 environment in VSCode.
Create an __init__.py file and add the above script to it.
Use the vscode-python extension to attempt to debug the __init__.py file with the "Python: Current File (Integrated Terminal)" launch profile.
Logs
Output for Python in the Output panel: None.
Output from Console under the Developer Tools panel: None.(Not strictly true. There is an "[Extension Host] undefined session received in acceptDebugSessionStarted" error but it seems unrelated as it appears regardless of the contents of the file being debugged.)
The text was updated successfully, but these errors were encountered:
The following simple script was adapted from the "Executing code in thread or process pools" documentation for Python 3.7. The adaptations allow the code to be run in Python 3.6.
Running the code above with the Python: Current File (Integrated Terminal) debugger profile appears to result in a deadlock (no pid is printed from the
cpu_bound
function). Running that very same code directly with Python 3.6 via the command line works as expected. If theProcessPoolExecutor
is replaced withThreadPoolExecutor
the code appears to run fine using the debugger.Environment data
Expected behaviour
The script runs to completion and prints two pid numbers and the result of the computation:
Actual behaviour
The script prints the first pid and then pauses until the user manually stops the debugger. Output:
Steps to reproduce:
__init__.py
file and add the above script to it.__init__.py
file with the "Python: Current File (Integrated Terminal)" launch profile.Logs
Output for
Python
in theOutput
panel: None.Output from
Console
under theDeveloper Tools
panel: None. (Not strictly true. There is an "[Extension Host] undefined session received in acceptDebugSessionStarted" error but it seems unrelated as it appears regardless of the contents of the file being debugged.)The text was updated successfully, but these errors were encountered: