Skip to content

Commit

Permalink
uds: fix thread safety issues
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Hofstetter <[email protected]>
  • Loading branch information
mhofstetter authored and sayboras committed Jan 3, 2025
1 parent 16c6ab8 commit dfaf444
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bazel/toolchains/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ cc_toolchain_config(
"-fstack-protector",
"-Wall",
"-Wunused-but-set-parameter",
"-Wthread-safety-analysis",
"-Wno-free-nonheap-object",
"-fno-omit-frame-pointer",
# Needed by Envoy dependencies to build:
Expand Down Expand Up @@ -135,6 +136,7 @@ cc_toolchain_config(
"-fstack-protector",
"-Wall",
"-Wunused-but-set-parameter",
"-Wthread-safety-analysis",
"-Wno-free-nonheap-object",
"-fno-omit-frame-pointer",
# Needed by Envoy dependencies to build:
Expand Down
2 changes: 2 additions & 0 deletions cilium/uds_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ void UDSClient::Log(const std::string& msg) {
}

// rate-limit to 1/second to avoid spamming the logs
fd_mutex_.lock();
if (logging_limiter_->consume(1, false)) {
ENVOY_LOG(warn, "Logging to {} failed: {}", asStringView(), Envoy::errorDetails(errno_));
}
fd_mutex_.unlock();
}

bool UDSClient::try_connect() {
Expand Down

0 comments on commit dfaf444

Please sign in to comment.