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

When debugging with pypy the debuggee runs twice #604

Closed
karthiknadig opened this issue Apr 30, 2021 · 5 comments
Closed

When debugging with pypy the debuggee runs twice #604

karthiknadig opened this issue Apr 30, 2021 · 5 comments

Comments

@karthiknadig
Copy link
Member

I've tried the insiders build after seeing this issue (latest stable release was complaining about pypy with The Python path in your debug configuration is invalid). There error message that there is no valid config is gone (and vscode also show the pypy in the status bar), but the debugger will be started twice and so I get an error popup every time I start my script.

I always get the error Server[pid=18868] is already being debugged. when I try to run my script via F5. My test script is just print("test"). The test is showed in the terminal and debugging works! My terminal output looks like following

c:; cd 'c:\Users\username\mypytest'; & 'c:\Users\username\mypytest\env\Scripts\pypy3.exe' 'c:\Users\tbam\.vscode-insiders\extensions\ms-python.python-2021.5.797839398-dev\pythonFiles\lib\python\debugpy\launcher' '58371' '--' 'c:\Users\username\mypytest\t.py'
Process32First failed (getting process from CreateToolhelp32Snapshot).
test

It seems that your extension try to run the debugger twice.

I'm using the lastest x64 version of pypy for windows.

Python 3.7.10 (51efa818fd9b, Apr 04 2021, 12:09:32)
[PyPy 7.3.4 with MSC v.1927 64 bit (AMD64)] on win32

Greetings
Michael

Originally posted by @tonka3000 in microsoft/vscode-python#16042 (comment)

@karthiknadig
Copy link
Member Author

@tonka3000 Can you set logToFile to true, in the launch json? The logs will be stored in the extension directory (%USERPROFILE%\.vscode-insiders\extensions\ms-python.python-2021.5.797839398-dev), please share all the log files.

@tonka3000
Copy link

Sure.
logfiles.zip

Sometimes I also got this stack trace in the terminal during starting.

Traceback (most recent call last):
  File "C:\Programs\pypy\lib-python\3\runpy.py", line 196, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Programs\pypy\lib-python\3\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\Users\username\.vscode-insiders\extensions\ms-python.python-2021.5.797839398-dev\pythonFiles\lib\python\debugpy\launcher\__main__.py", line 95, in <module>le>
    main()
  File "c:\Users\username\.vscode-insiders\extensions\ms-python.python-2021.5.797839398-dev\pythonFiles\lib\python\debugpy\launcher\__main__.py", line 52, in main
    launcher.channel.wait()
  File "c:\Users\username\.vscode-insiders\extensions\ms-python.python-2021.5.797839398-dev\pythonFiles\lib\python\debugpy\launcher/../..\debugpy\common\messaging.py"py", line 1215, in wait
    parser_thread.join()
  File "C:\Programs\pypy\lib-python\3\threading.py", line 1044, in join
    self._wait_for_tstate_lock()
  File "C:\Programs\pypy\lib-python\3\threading.py", line 1062, in _wait_for_tstate_lock
    self._stop()
  File "C:\Programs\pypy\lib-python\3\threading.py", line 996, in _stop
    assert not lock.locked()
AssertionError

@abcdehc
Copy link

abcdehc commented May 27, 2021

I ran into the same problem. And the internal build cannot be installed successfully.
microsoft/vscode-python#16042 (comment)

@fabioz
Copy link
Collaborator

fabioz commented May 27, 2021

I can reproduce the issues. It really seems that debugpy is kind of broken with PyPy right now (it kind of works but has some weird interactions such as the sporadic traceback and the error saying that the program is already being debugged).

@karthiknadig @int19h should we start to officially support/test PyPy? (i.e.: right now we don't officially support it/ it's not in the ci)

As a note, pydevd does support PyPy / run it in the ci (so, I think the issues are on the debugpy part of the integration).

fabioz added a commit to fabioz/debugpy that referenced this issue May 31, 2021
@fabioz
Copy link
Collaborator

fabioz commented May 31, 2021

I just provided a pull request for the issues in PyPy... this doesn't mean it's officially supported since we don't run it in the ci, but at least it should start-up the debugging properly with this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants