Skip to content

Conversation

ggouaillardet
Copy link
Contributor

getenv() is not thread-safe so it should not be invoked within a callback subroutine. So read the environment at initialization and cache the result.

Thanks Zdeněk Salvet for reporting this issue.

Refs #13428

getenv() is not thread-safe so it should not be invoked
within a callback subroutine. So read the environment
at initialization and cache the result.

Thanks Zdeněk Salvet for reporting this issue.

Refs open-mpi#13428

Signed-off-by: Gilles Gouaillardet <[email protected]>
@rhc54
Copy link
Contributor

rhc54 commented Oct 10, 2025

It's okay if you want to do this, but we should acknowledge that this is just a bandaid that somewhat improves a race condition for a specific user and a specific application - see the discussion on the referenced issue. My concern is that we fool ourselves into thinking this actually fixes things in a more general sense, and then wind up chasing all the env-related operations in the code base. The only real fix is the change made to glibc last year - not sure when we'll see that released and widely installed.

@ggouaillardet ggouaillardet marked this pull request as ready for review October 13, 2025 06:00
@ggouaillardet
Copy link
Contributor Author

I marked this PR as ready for review.

As discussed in #13428, this is not a proper fix (the right fix will be provided by the latest/upcoming(?) glibc) but a band aid that might have some side effects, so I will let someone else decide whether this PR should be merged or simply closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants