Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Unfriendly traceback when sampling from an unknown PID #142654

Copy link
Copy link
@kemingy

Description

@kemingy
Issue body actions

Bug report

Bug description:

./python -m profiling.sampling attach -1

This produces:

OSError: Cannot open process memory map file '/proc/-1/maps' for PID -1 section search: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/keming/GitHub/cpython/Lib/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
                     "__main__", mod_spec)
  File "/home/keming/GitHub/cpython/Lib/runpy.py", line 87, in _run_code
    exec(code, run_globals)
    ~~~~^^^^^^^^^^^^^^^^^^^
  File "/home/keming/GitHub/cpython/Lib/profiling/sampling/__main__.py", line 64, in <module>
    main()
    ~~~~^^
  File "/home/keming/GitHub/cpython/Lib/profiling/sampling/cli.py", line 592, in main
    handler(args)
    ~~~~~~~^^^^^^
  File "/home/keming/GitHub/cpython/Lib/profiling/sampling/cli.py", line 620, in _handle_attach
    collector = sample(
        args.pid,
    ...<8 lines>...
        opcodes=args.opcodes,
    )
  File "/home/keming/GitHub/cpython/Lib/profiling/sampling/sample.py", line 327, in sample
    profiler = SampleProfiler(
        pid,
    ...<7 lines>...
        collect_stats=realtime_stats,
    )
  File "/home/keming/GitHub/cpython/Lib/profiling/sampling/sample.py", line 39, in __init__
    self.unwinder = _remote_debugging.RemoteUnwinder(
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        self.pid, all_threads=self.all_threads, mode=mode, native=native, gc=gc,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        opcodes=opcodes, skip_non_matching_threads=skip_non_matching_threads,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        cache_frames=True, stats=collect_stats
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
RuntimeError: Failed to find the PyRuntime section in process -1 on Linux platform

This is similar to #139940

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.15pre-release feature fixes, bugs and security fixespre-release feature fixes, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-profilingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.