intel / intel/gprofiler

tests: py-spy fails on multiple 3.x pythons, musl on aarch64

Open
#714 0 comments 0 reactions 0 assignees View on GitHub
runtime/python tests
Dominant language
Python
Stars
826
Forks
79
PR merge metrics
No merged PRs in 30d

Description

Failing tests:
```
FAILED tests/test_python.py::test_python_matrix[py-spy-3.7-musl-python-True]
FAILED tests/test_python.py::test_python_matrix[py-spy-3.8-musl-python-True]
FAILED tests/test_python.py::test_python_matrix[py-spy-3.9-musl-python-True]
FAILED tests/test_python.py::test_python_matrix[py-spy-3.10-musl-python-True]
FAILED tests/test_python.py::test_python_matrix[py-spy-3.7-musl-uwsgi-True]
```
Exemplary error output:
```
_______________ test_python_matrix[py-spy-3.9-musl-python-True] ________________

application_pid = 2412579
assert_collapsed = functools.partial(, 'burner')
profiler_type = 'py-spy', application_image_tag = '3.9-musl-python'
profiler_state =

@pytest.mark.parametrize("in_container", [True])
@pytest.mark.parametrize(
"application_image_tag",
[
"2.7-glibc-python",
"2.7-musl-python",
"3.5-glibc-python",
"3.5-musl-python",
"3.6-glibc-python",
"3.6-musl-python",
"3.7-glibc-python",
"3.7-musl-python",
"3.8-glibc-python",
"3.8-musl-python",
"3.9-glibc-python",
"3.9-musl-python",
"3.10-glibc-python",
"3.10-musl-python",
"2.7-glibc-uwsgi",
"2.7-musl-uwsgi",
"3.7-glibc-uwsgi",
"3.7-musl-uwsgi",
],
)
@pytest.mark.parametrize("profiler_type", ["py-spy", "pyperf"])
def test_python_matrix(
application_pid: int,
assert_collapsed: AssertInCollapsed,
profiler_type: str,
application_image_tag: str,
profiler_state: ProfilerState,
) -> None:
python_version, libc, app = application_image_tag.split("-")

# pyperf is not working on aarch right now https://github.com/Granulate/gprofiler/issues/499
if platform.machine() == "aarch64" and profiler_type == "pyperf":
pytest.skip("PyPerf doesn't support aarch64 architecture!")

if python_version == "3.5" and profiler_type == "pyperf":
pytest.skip("PyPerf doesn't support Python 3.5!")

if python_version == "2.7" and profiler_type == "pyperf" and app == "uwsgi":
pytest.xfail("This combination fails, see https://github.com/Granulate/gprofiler/issues/485")

if python_version == "2.7" and profiler_type == "py-spy" and app == "uwsgi":
pytest.xfail("This combination fails, see ")

# if python_version in ["2.7", "3.7", "3.8", "3.9", "3.10"] and profiler_type == "py-spy" and libc == "musl":
# pytest.xfail("This combination fails, see ")

with PythonProfiler(1000, 2, profiler_state, profiler_type, True, None) as profiler:
profile = snapshot_pid_profile(profiler, application_pid)

collapsed = profile.stacks

> assert_collapsed(collapsed)

tests/test_python.py:102:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

function_name = 'burner'
collapsed = ProfilingErrorStack({'python;[Profiling error: exception CalledProcessError]': 1})

def assert_function_in_collapsed(function_name: str, collapsed: StackToSampleCount) -> None:
print(f"collapsed: {collapsed}")
> assert is_function_in_collapsed(function_name, collapsed), f"function {function_name!r} missing in collapsed data!"
E AssertionError: function 'burner' missing in collapsed data!

tests/utils.py:171: AssertionError
----------------------------- Captured stdout call -----------------------------
collapsed: ProfilingErrorStack({'python;[Profiling error: exception CalledProcessError]': 1})
------------------------------ Captured log call -------------------------------
WARNING gprofiler.profilers.profiler_base:__init__.py:467 PySpyProfiler: Requested frequency (1000) is higher than the limit 50, limiting the frequency to the limit (50)
ERROR gprofiler.profilers.profiler_base:profiler_base.py:145 PySpyProfiler: failed to profile process 2412579 (python)
Traceback (most recent call last):
File "/home/ubuntu/gprofiler/gprofiler/profilers/profiler_base.py", line 132, in _wait_for_profiles
result = future.result()
File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.__get_result()
File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/ubuntu/gprofiler/gprofiler/profilers/python.py", line 218, in _profile_process
run_process(
File "/home/ubuntu/gprofiler/gprofiler/utils/__init__.py", line 284, in run_process
raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr)
gprofiler.exceptions.CalledProcessError: Command ['/home/ubuntu/gprofiler/gprofiler/resources/python/py-spy', 'record', '-r', '50', '-d', '2', '--nonblocking', '--format', 'raw', '-F', '--output', '/tmp/pytest-of-root/pytest-20/test_python_matrix_py_spy_3_9_1/tmp7qms4pkc/pyspy.lvTPkHtCXoozQtjv.2412579.col', '-p', '2412579', '--full-filenames', '--gil'] returned non-zero exit status 1.
stdout: b''
stderr: b'Error: Bad address (os error 14)\n\n'
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.