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

Subprocess and json flags don't work together #601

Open
JRoper18 opened this issue Aug 7, 2023 · 0 comments · May be fixed by #602
Open

Subprocess and json flags don't work together #601

JRoper18 opened this issue Aug 7, 2023 · 0 comments · May be fixed by #602

Comments

@JRoper18
Copy link

JRoper18 commented Aug 7, 2023

Specifying both the json and subprocess flags will only print out the dump of the root process and will ignore subprocesses. For example, when running the following python program:

import time
from multiprocessing import Process
def work():
    time.sleep(1000)

for _ in range(10):
    p = Process(target=work, daemon=True)
    p.start()

time.sleep(1000)

And then running:

py-spy dump -js --pid <pid>

Will only return the dump of the root process:

[
  {
    "pid": 16866,
    "thread_id": 140634802636608,
    "thread_name": "MainThread",
    "os_thread_id": 16866,
    "active": false,
    "owns_gil": false,
    "frames": [
      {
        "name": "<module>",
        "filename": "main.py",
        "module": null,
        "short_filename": "main.py",
        "line": 10,
        "locals": null
      }
    ],
    "process_info": null
  }
]

I would expect it to return dumps of all the processes/threads, instead.

@JRoper18 JRoper18 linked a pull request Aug 7, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant