Skip to content

Commit

Permalink
runtime: deprecating envoy.restart_features.allow_client_socket_creat…
Browse files Browse the repository at this point in the history
…ion_failure

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
  • Loading branch information
alyssawilk committed Oct 15, 2024
1 parent 5129541 commit 2fc8f48
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 23 deletions.
3 changes: 3 additions & 0 deletions changelogs/current.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ bug_fixes:

removed_config_or_runtime:
# *Normally occurs at the end of the* :ref:`deprecation period <deprecated>`
- area: upstream
change: |
Removed runtime flag ``envoy.restart_features.allow_client_socket_creation_failure`` and legacy code paths.
new_features:

Expand Down
20 changes: 4 additions & 16 deletions source/common/network/socket_interface_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,29 +93,17 @@ IoHandlePtr SocketInterfaceImpl::socket(Socket::Type socket_type, Address::Type
const Api::SysCallSocketResult result =
Api::OsSysCallsSingleton::get().socket(domain, flags, protocol);
if (!SOCKET_VALID(result.return_value_)) {
if (Runtime::runtimeFeatureEnabled(
"envoy.restart_features.allow_client_socket_creation_failure")) {
IS_ENVOY_BUG(fmt::format("socket(2) failed, got error: {}", errorDetails(result.errno_)));
return nullptr;
} else {
RELEASE_ASSERT(!SOCKET_VALID(result.return_value_),
fmt::format("socket(2) failed, got error: {}", errorDetails(result.errno_)));
}
IS_ENVOY_BUG(fmt::format("socket(2) failed, got error: {}", errorDetails(result.errno_)));
return nullptr;
}
IoHandlePtr io_handle = makeSocket(result.return_value_, socket_v6only, domain, options);

#if defined(__APPLE__) || defined(WIN32)
// Cannot set SOCK_NONBLOCK as a ::socket flag.
const int rc = io_handle->setBlocking(false).return_value_;
if (SOCKET_FAILURE(result.return_value_)) {
if (Runtime::runtimeFeatureEnabled(
"envoy.restart_features.allow_client_socket_creation_failure")) {
IS_ENVOY_BUG(fmt::format("Unable to set socket non-blocking: got error: {}", rc));
return nullptr;
} else {
RELEASE_ASSERT(SOCKET_FAILURE(rc),
fmt::format("Unable to set socket non-blocking: got error: {}", rc));
}
IS_ENVOY_BUG(fmt::format("Unable to set socket non-blocking: got error: {}", rc));
return nullptr;
}
#endif

Expand Down
1 change: 0 additions & 1 deletion source/common/runtime/runtime_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ RUNTIME_GUARD(envoy_reloadable_features_validate_grpc_header_before_log_grpc_sta
RUNTIME_GUARD(envoy_reloadable_features_validate_upstream_headers);
RUNTIME_GUARD(envoy_reloadable_features_xds_failover_to_primary_enabled);
RUNTIME_GUARD(envoy_reloadable_features_xdstp_path_avoid_colon_encoding);
RUNTIME_GUARD(envoy_restart_features_allow_client_socket_creation_failure);
RUNTIME_GUARD(envoy_restart_features_allow_slot_destroy_on_worker_threads);
RUNTIME_GUARD(envoy_restart_features_fix_dispatcher_approximate_now);
RUNTIME_GUARD(envoy_restart_features_quic_handle_certs_with_shared_tls_code);
Expand Down
5 changes: 1 addition & 4 deletions source/extensions/upstreams/http/udp/upstream_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ class UdpConnPool : public Router::GenericConnPool {
auto ret = std::make_unique<Network::SocketImpl>(
Network::Socket::Type::Datagram, host->address(),
/*remote_address=*/nullptr, Network::SocketCreationOptions{});
if (Runtime::runtimeFeatureEnabled(
"envoy.restart_features.allow_client_socket_creation_failure")) {
RELEASE_ASSERT(ret->isOpen(), "Socket creation fail");
}
RELEASE_ASSERT(ret->isOpen(), "Socket creation fail");
return ret;
}

Expand Down
2 changes: 0 additions & 2 deletions test/integration/protocol_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4770,8 +4770,6 @@ class AllowForceFail : public Api::OsSysCallsImpl {
};

TEST_P(ProtocolIntegrationTest, HandleUpstreamSocketCreationFail) {
config_helper_.addRuntimeOverride("envoy.restart_features.allow_client_socket_creation_failure",
"true");
AllowForceFail fail_socket_n_;
TestThreadsafeSingletonInjector<Api::OsSysCallsImpl> os_calls{&fail_socket_n_};

Expand Down

0 comments on commit 2fc8f48

Please sign in to comment.