Skip to content

Commit 400dacb

Browse files
committed
Don't insert into overlay options on lookup
getOverlayOption used operator[], so the first lookups of an unset key (e.g. ssl-enabled, read on every session launch) inserted into the map from concurrent request threads. ThreadSanitizer flagged the race in the concurrent SessionManager launch tests.
1 parent db06620 commit 400dacb

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎src/cpp/server/include/server/ServerOptions.hpp‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ class Options : public GeneratedOptions,
9090
bool checkConfigMode() const { return checkConfigMode_; }
9191
bool setupDbMode() const { return setupDbMode_; }
9292

93-
std::string getOverlayOption(const std::string& name)
93+
std::string getOverlayOption(const std::string& name) const
9494
{
95-
return overlayOptions_[name];
95+
auto it = overlayOptions_.find(name);
96+
return it != overlayOptions_.end() ? it->second : std::string();
9697
}
9798

9899
private:

0 commit comments

Comments
 (0)