Like the documentation for our `set_var` (setenv) says, care must be taken with … mutating environment variables in a multithreaded program. See [th

Synchronized FFI access to POSIX environment variable functions

submited by
Style Pass
2021-11-25 21:00:06

Like the documentation for our `set_var` (setenv) says, care must be taken with … mutating environment variables in a multithreaded program. See [this glibc bug #13271](https://sourceware.org/bugzilla/show_bug.cgi?id=13271) that says getaddrinfo may call getenv. It looks like we have an unsynchronized call to getaddrinfo and this may cause trouble with glibc/Linux. Seeing glibc's attitude to setenv in multithreaded programs, `set_var` seems like a big hazard in general(?). Discovered as an issue tangential to #27966 cc @alexcrichton

Leave a Comment