Calling setenv during init is unsafe for multithreaded programs #521
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
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 thesegetenv
calls if they occur concurrently with aws-c-io init, which callssetenv
inaws_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.The text was updated successfully, but these errors were encountered: