Granulate / gprofiler

gProfiler is a system-wide profiler, combining multiple sampling profilers to produce unified visualization of what your CPU is spending time on.
https://profiler.granulate.io
Apache License 2.0
746 stars 54 forks source link

tests: tests/test_sanity.py::test_dotnet_trace[False-dotnet] fails on aarch64 #755

Open pfilipko1 opened 1 year ago

pfilipko1 commented 1 year ago
in_container = False, command_line = ['dotnet', '/tmp/pytest-of-root/pytest-38/artifacts0/dotnet/Fibonacci/Fibonacci.dll', '--project', '/tmp/pytest-of-root/pytest-38/artifacts0/dotnet/Fibonacci'], check_app_exited = True

    @fixture
    def application_process(
        in_container: bool, command_line: List[str], check_app_exited: bool                                                                                                                                                                                                           ) -> Iterator[Optional[subprocess.Popen]]:
        if in_container:                                                                                                                                                                                                                                                                      yield None
            return
        else:
>           with _application_process(command_line, check_app_exited) as popen:

tests/conftest.py:217:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.10/contextlib.py:135: in __enter__
    return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

command_line = ['dotnet', '/tmp/pytest-of-root/pytest-27/artifacts0/dotnet/Fibonacci/Fibonacci.dll', '--project', '/tmp/pytest-of-root/pytest-27/artifacts0/dotnet/Fibonacci'], check_app_exited = True

    @contextmanager
    def _application_process(command_line: List[str], check_app_exited: bool) -> Iterator[subprocess.Popen]:
        # run as non-root to catch permission errors, etc.
        def lower_privs() -> None:
            os.setgid(1000)
            os.setuid(1000)

        popen = subprocess.Popen(
            command_line, preexec_fn=lower_privs, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd="/tmp"
        )
        try:
            # wait 2 seconds to ensure it starts
            popen.wait(2)
        except subprocess.TimeoutExpired:
            pass
        else:
            _print_process_output(popen)
>           raise Exception(f"Command {command_line} exited unexpectedly with {popen.returncode}")
E           Exception: Command ['dotnet', '/tmp/pytest-of-root/pytest-27/artifacts0/dotnet/Fibonacci/Fibonacci.dll', '--project', '/tmp/pytest-of-root/pytest-27/artifacts0/dotnet/Fibonacci'] exited unexpectedly with 1

tests/utils.py:318: Exception
----------------------------------------------------------------------------------------------------------------------------- Captured stdout setup ------------------------------------------------------------------------------------------------------------------------------
stdout:
stderr: System.UnauthorizedAccessException: Access to the path '/root/.dotnet' is denied.
 ---> System.IO.IOException: Permission denied
   --- End of inner exception stack trace ---
   at System.IO.FileSystem.CreateDirectory(String fullPath)
   at System.IO.Directory.CreateDirectory(String path)
   at Microsoft.Extensions.EnvironmentAbstractions.DirectoryWrapper.CreateDirectory(String path)
   at Microsoft.DotNet.Configurer.FileSystemExtensions.<>c__DisplayClass0_0.<CreateIfNotExists>b__0()
   at Microsoft.DotNet.Cli.Utils.FileAccessRetrier.RetryOnIOException(Action action)
   at Microsoft.DotNet.Configurer.FileSystemExtensions.CreateIfNotExists(IFileSystem fileSystem, String filePath)
   at Microsoft.DotNet.Configurer.FileSentinel.Create()
   at Microsoft.DotNet.Configurer.DotnetFirstTimeUseConfigurer.Configure()
   at Microsoft.DotNet.Cli.Program.ConfigureDotNetForFirstTimeUse(IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel, IAspNetCertificateSentinel aspNetCertificateSentinel, IFileSentinel toolPathSentinel, Boolean isDotnetBeingInvokedFromNativeInstaller, DotnetFirstRunConfiguration dotnetFirstRunConfiguration, IEnvironmentProvider environmentProvider, Dictionary`2 performanceMeasurements)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)
   at Microsoft.DotNet.Cli.Program.Main(String[] args)

----------------------------------------------------------------------------------------------------------------------------- Captured stderr setup ------------------------------------------------------------------------------------------------------------------------------
No usable version of libssl was found
rm: cannot remove 'Program.cs': No such file or directory
No usable version of libssl was found
================================================================================================================================ warnings summary ================================================================================================================================
test_sanity.py::test_dotnet_trace[False-dotnet]
  /usr/local/lib/python3.10/dist-packages/docker/utils/utils.py:52: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    s1 = StrictVersion(v1)

test_sanity.py::test_dotnet_trace[False-dotnet]
  /usr/local/lib/python3.10/dist-packages/docker/utils/utils.py:53: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    s2 = StrictVersion(v2)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
pfilipko1 commented 1 year ago

The error underneath says:

No usable version of the libssl was found
Aborted

and it is related with dotnet 3.0 and ubuntu 22.04 combination. The solution is to install the correct deb package manually (apt install openssl-dev does not work), but there seems to be no version for aarch64 :(

http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/

Jongy commented 1 year ago

Maybe this part is the actual problem?

stderr: System.UnauthorizedAccessException: Access to the path '/root/.dotnet' is denied.
 ---> System.IO.IOException: Permission denied
   --- End of inner exception stack trace ---
   at System.IO.FileSystem.CreateDirectory(String fullPath)
   at System.IO.Directory.CreateDirectory(String path)
   at Microsoft.Extensions.EnvironmentAbstractions.DirectoryWrapper.CreateDirectory(String path)
   at Microsoft.DotNet.Configurer.FileSystemExtensions.<>c__DisplayClass0_0.<CreateIfNotExists>b__0()
   at Microsoft.DotNet.Cli.Utils.FileAccessRetrier.RetryOnIOException(Action action)
   at Microsoft.DotNet.Configurer.FileSystemExtensions.CreateIfNotExists(IFileSystem fileSystem, String filePath)
   at Microsoft.DotNet.Configurer.FileSentinel.Create()
   at Microsoft.DotNet.Configurer.DotnetFirstTimeUseConfigurer.Configure()
   at Microsoft.DotNet.Cli.Program.ConfigureDotNetForFirstTimeUse(IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel, IAspNetCertificateSentinel aspNetCertificateSentinel, IFileSentinel toolPathSentinel, Boolean isDotnetBeingInvokedFromNativeInstaller, DotnetFirstRunConfiguration dotnetFirstRunConfiguration, IEnvironmentProvider environmentProvider, Dictionary`2 performanceMeasurements)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)
   at Microsoft.DotNet.Cli.Program.Main(String[] args)

Trying to access /root/.dotnet which behaves differently on the Aarch64 server image (for example, permissions are different, ...)