Bug report
Bug description:
Running python -m profiling.sampling run --subprocesses <...> on some code that spawns subprocesses will ignore any PermissionError thrown in the child processes when doing a attach to the process, since stderr is forwarded to /dev/null, and the process exits with error code 0 (my mistake, it does exit with exit code 1, just the call is in the helper function). This causes confusion as the only user-visible effect is that the subprocesses sampling data files are not created.
This can happen when the user / python executable / kernel doesn't have the CAP_SYS_PTRACE capability, so the run subcommand works fine, but any attach will fail, which is what happens with the child processes.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Bug report
Bug description:
Running
python -m profiling.sampling run --subprocesses <...>on some code that spawns subprocesses will ignore anyPermissionErrorthrown in the child processes when doing aattachto the process, sincestderris forwarded to/dev/null, andthe process exits with error code(my mistake, it does exit with exit code 1, just the call is in the helper function). This causes confusion as the only user-visible effect is that the subprocesses sampling data files are not created.0This can happen when the user / python executable / kernel doesn't have the
CAP_SYS_PTRACEcapability, so therunsubcommand works fine, but anyattachwill fail, which is what happens with the child processes.CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs