KeyboardInterrupt error exiting debug mode in PyCharm

Hello,

After upgrading PyCharm from 2021.1.3 to 2022.1 (Community version) a weird issue appeared. My previously working codes which use the ray library started to throw an exception after finishing in debug mode. Normal runs return with 0, only debug mode is affected. During upgrade my config was kept.

Even this code:

import ray
ray.init()

results in this exception:

Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "C:\Users\user\PycharmProjects\venv\lib\site-packages\ray\_private\client_mode_hook.py", line 105, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\user\PycharmProjects\venv\lib\site-packages\ray\worker.py", line 1146, in shutdown
    global_worker.core_worker.shutdown()
KeyboardInterrupt

I’m using Python 3.9, ray 1.12.0 (also appeared while using 1.11.0 but still persists after upgrade) and Windows 10.

Do you have an idea what could be the cause?

I have the same problem. Ray 2.3.1. PyCharm 2021.2.3 Community Edition. Python 3.9.16. Mac OS 13.3. If I try to run ray.init() in the PyCharm debugger, it fails with

/usr/local/anaconda3/envs/lingua/bin/python "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 49909 --file /Users/bill.mcneill/Src/rayadd.py
Connected to pydev debugger (build 212.5457.59)
2023-04-14 14:04:34,463	INFO worker.py:1544 -- Started a local Ray instance. View the dashboard at 127.0.0.1:8265 
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/local/anaconda3/envs/lingua/lib/python3.9/site-packages/ray/_private/node.py", line 1220, in _kill_process_type
    self._kill_process_impl(
  File "/usr/local/anaconda3/envs/lingua/lib/python3.9/site-packages/ray/_private/node.py", line 1276, in _kill_process_impl
    process.wait(timeout_seconds)
  File "/usr/local/anaconda3/envs/lingua/lib/python3.9/subprocess.py", line 1189, in wait
    return self._wait(timeout=timeout)
  File "/usr/local/anaconda3/envs/lingua/lib/python3.9/subprocess.py", line 1911, in _wait
    time.sleep(delay)
KeyboardInterrupt

Process finished with exit code 0

More complicated Ray code fails as well. Running in PyCharm without debug is fine. Rebooting the computer does not fix the problem.

PyCharm debugging worked fine on this machine yesterday. I don’t know what has changed.

cc: @sangcho @rickyyx