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

Calling setenv during init is unsafe for multithreaded programs #521

Closed
johnwheffner opened this issue Oct 18, 2022 · 1 comment
Closed
Labels
bug This issue is a bug. needs-review This issue or pull request needs review from a core team member. p2 This is a standard priority issue

Comments

@johnwheffner
Copy link

We have an application that runs on Linux and uses the AWS C++ SDK. It's a multithreaded application, and for reasons it initializes the AWS SDK (and transitively the aws-c-io library) after there are already a number of threads executing. Some of these threads may at times call getenv. We get crashes in these getenv calls if they occur concurrently with aws-c-io init, which calls setenv in aws_tls_init_static_state. According to the glibc docs, "Modifications of environment variables are not allowed in multi-threaded programs."

It would be better to avoid the setenv call.

@jmklix jmklix added bug This issue is a bug. p2 This is a standard priority issue needs-review This issue or pull request needs review from a core team member. labels Jan 10, 2024
@graebm graebm mentioned this issue Mar 26, 2024
@jmklix
Copy link
Member

jmklix commented Jun 17, 2024

Closing. This was fixed in this PR: #634

@jmklix jmklix closed this as completed Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-review This issue or pull request needs review from a core team member. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

2 participants