Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more logic in the shell detection code to handle a case where the parent PID is zero #1735

Conversation

JeanChristopheMorinPerso
Copy link
Member

@JeanChristopheMorinPerso JeanChristopheMorinPerso commented Apr 27, 2024

Fixes #1732

Add more logic in the shell detection code to handle a case where the parent PID is zero. This can happen when run from within a docker container with a non-interactive shell.

This was not necessarily a hard error. rez would just print an annoying error.

Before:

$ docker run --rm -it rocky_rez rez-env python -- python --version
os.getpid() 0
error: process ID out of range

Usage:
 ps [options]

 Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).
Python 3.9.18

After:

$ docker run --rm -it rocky_rez rez-env python -- python --version
Python 3.9.18

Copy link

codecov bot commented Apr 27, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 58.30%. Comparing base (f63031e) to head (3f97be0).

Files Patch % Lines
src/rez/system.py 90.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1735      +/-   ##
==========================================
- Coverage   58.30%   58.30%   -0.01%     
==========================================
  Files         126      126              
  Lines       17159    17161       +2     
  Branches     3505     3506       +1     
==========================================
+ Hits        10004    10005       +1     
  Misses       6492     6492              
- Partials      663      664       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@darkvertex
Copy link

I confirm this resolved #1732 for me.

ps: Someone needs to check out the macos py3.7 CI environment. It seems pretty broken.

@JeanChristopheMorinPerso
Copy link
Member Author

Thanks @darkvertex for confirming! As for the macos builds, we'll have to fix them. The failures are caused by the new default macos-latest, which is now macos-14 which themselves are M1 runners. And 3.7 was not compatible with macOS arm64.

Anyway, I'll probably fix the macos thing in another PR.

… parent PID is zero. This can happen when run from within a docker container with a non-interactive shel.

Signed-off-by: Jean-Christophe Morin <[email protected]>
@JeanChristopheMorinPerso JeanChristopheMorinPerso force-pushed the fix_pid_out_of_range_docker branch from 400d45d to 3f97be0 Compare May 12, 2024 16:13
@JeanChristopheMorinPerso JeanChristopheMorinPerso merged commit 71d990b into AcademySoftwareFoundation:main May 12, 2024
47 checks passed
@JeanChristopheMorinPerso JeanChristopheMorinPerso deleted the fix_pid_out_of_range_docker branch May 12, 2024 16:19
@JeanChristopheMorinPerso JeanChristopheMorinPerso added this to the Next milestone Jun 22, 2024
Pixel-Minions added a commit to Pixel-Minions/rez that referenced this pull request Sep 26, 2024
… parent PID is zero. This can happen when run from within a docker container with a non-interactive shel. (AcademySoftwareFoundation#1735)

Signed-off-by: Jean-Christophe Morin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"process ID out of range" error when using rez-env from within a Docker container with namespaced PIDs
2 participants