Remote Debug (server) Pycharm 2021.3.3 does not stop at breakpoints

Answered

The following (simplified) code used to run perfectly well a week or two ago. Now, it does not stop at breakpoints. The code runs and finishes, but the red breakpoints are ignored. Pycharm updated recently which I guess has something to do with that. It also asked me to update my pydevd-pycharm, after updating the warning was removed but this problem persisted.

python3.8

pip freeze:

certifi==2021.10.8 
numpy==1.22.3

pandas==1.4.2

pydevd-pycharm==213.7172.26                                                                                                                                                                 
python-dateutil==2.8.2 
pytz==2022.1
six==1.16.0  

Running doesn't stop, but prints:


Use the following code to connect to the debugger:
import pydevd_pycharm
pydevd_pycharm.settrace('localhost', port=12345, stdoutToServer=True, stderrToServer=True)
Waiting for process connection…
Connected to pydev debugger (build 213.7172.26)
Running
Stopping?
Waiting for process connection…

import argparse
import os

def main():
parser = argparse.ArgumentParser()
parser.add_argument("--debug", action="store_true")
args, _ = parser.parse_known_args()

if args.debug:

debug_ip = os.environ.get('SSH_CONNECTION', None) # this is the default value for debug_ip
if len(debug_ip.split()) > 0:
debug_ip = debug_ip.split()[0]
debug_port = 12345 # this is the default value for debug_port


try:
import pydevd_pycharm
except ImportError:
Warning('Could not import pydevd_pycharm. Please follow installation instructions in: '
'https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html#remote-debug-config')
return

import pydevd_pycharm
pydevd_pycharm.settrace(debug_ip, port=int(debug_port)+int(os.environ.get('RANK',0)), stdoutToServer=True,
stderrToServer=True, suspend=False)
print(f'Running')
print("Stopping?")


if __name__ == '__main__':
main()
1
4 comments

It works fine in my test environment with your code. Does the remote debug server run on another computer?

Does the issue reproduce in a new project?

 

0

On another computer yes (what other use for this feature is there?)

What is a new project? I reproduced it on a new conda env 

Also worthy to note that using the remote debugging without the server is able to debug correctly.

Also happened to another person with the same code (and connecting to a similar if not the same computer) with a fresh installation and a fresh configuration and everything (new computer).

0

Did you check if the path mappings are correct in the run configuration?

1

Recreated the local server configurations and it worked (no idea why stopped working when pycharm updated, but unless it returns this seems to have done the trick)

0

Please sign in to leave a comment.