Closed darkvertex closed 2 months ago
Hi @darkvertex, thanks for the report and the detailed reproduction steps. I think we could probably check if the ppid is zero before doing running the ps
command.
I created https://github.com/AcademySoftwareFoundation/rez/pull/1735 which should fix it. Whenever you have time, can you try it out and see if it fixes the problem on your side please?
@JeanChristopheMorinPerso Your PR #1735 appears to resolve the bug. 😄
At my studio we have a Rocky image that resembles our workstation configuration and certain pipeline services use rez-env within containers to run some things.
I noticed while transitioning to use Rez in my containerized environment that it seems unhappy about namespaced PIDs, which is the default when you docker-run.
Environment
To Reproduce
I prepped a minimalist Dockerfile to reproduce the issue. Save this
Dockerfile
below:then
docker build . --tag=rocky_rez
and brew some tea or coffee cause it'll take a minute or two.To see the issue do any rez-env. Since this is a vanilla environment, use the python package made by the quickstarter:
As you can see, it does run the thing so it is kind of a harmless error, just scary looking.
One way to get around it is to pass
--pid=host
so that PID namespace isolation is no longer in place, thus the pids are shared with the host's, but this isn't great because it weakens the security of the container, as it is no longer process-isolated:...but it runs without an error.
I have a suspicion it is probably due to this command in the codebase here: https://github.com/AcademySoftwareFoundation/rez/blob/f17e88dad283826a5914e3aade4fbc9a010cdba2/src/rez/system.py#L84 and I guess it's because by default a container runs as PID 1, without a parent.
Could it be detected in the shell code so it does not print a scary error?
Expected behavior
I would expect this error-free output:
Actual behavior