Poco::Environment uses putenv, which does not copy the value, to set environment variables and holds the value in a static map. The map is protected by static mutex, but this is simply not a good idea because direct calls to system *env() are not protected by mutex.
putenv should be replaced with setenv, which makes a copy of the string. It is not guaranteed to be thread safe, but in practice it mostly is.
Poco::Environmentusesputenv, which does not copy the value, to set environment variables and holds the value in a static map. The map is protected by static mutex, but this is simply not a good idea because direct calls to system *env() are not protected by mutex.putenvshould be replaced withsetenv, which makes a copy of the string. It is not guaranteed to be thread safe, but in practice it mostly is.