Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions library/common/extensions/filters/http/platform_bridge/filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,28 +167,7 @@ void PlatformBridgeFilter::onDestroy() {
ENVOY_LOG(trace, "PlatformBridgeFilter({})::onDestroy", filter_name_);
alive_ = false;

auto& info = decoder_callbacks_->streamInfo();
if (response_filter_base_->state_.stream_complete_ && platform_filter_.on_error &&
StreamInfo::isStreamIdleTimeout(info)) {
// If the stream info has a response code details with a stream idle timeout, treat as error.
ENVOY_LOG(trace, "PlatformBridgeFilter({})->on_error", filter_name_);
envoy_data error_message = Data::Utility::copyToBridgeData("Stream idle timeout");
auto& info = decoder_callbacks_->streamInfo();
int32_t attempts = static_cast<int32_t>(info.attemptCount().value_or(0));

auto callback_time_ms = std::make_unique<Stats::HistogramCompletableTimespanImpl>(
config_->stats().on_error_callback_latency_, timeSource());

platform_filter_.on_error({ENVOY_REQUEST_TIMEOUT, error_message, attempts}, streamIntel(),
finalStreamIntel(), platform_filter_.instance_context);

callback_time_ms->complete();
auto elapsed = callback_time_ms->elapsed();
if (elapsed > SlowCallbackWarningThreshold) {
ENVOY_LOG_EVENT(warn, "slow_on_error_cb",
filter_name_ + "|" + std::to_string(elapsed.count()) + "ms");
}
} else if (!response_filter_base_->state_.stream_complete_ && platform_filter_.on_cancel) {
if (!response_filter_base_->state_.stream_complete_ && platform_filter_.on_cancel) {
// If the filter chain is destroyed before a response is received, treat as cancellation.
ENVOY_LOG(trace, "PlatformBridgeFilter({})->on_cancel", filter_name_);

Expand Down
11 changes: 2 additions & 9 deletions test/swift/integration/IdleTimeoutTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,6 @@ static_resources:
- endpoint:
address:
socket_address: { address: 127.0.0.1, port_value: \(remotePort) }
layered_runtime:
layers:
- name: static_layer_0
static_layer:
envoy:
reloadable_features:
override_request_timeout_by_gateway_timeout: false
"""

class IdleTimeoutValidationFilter: AsyncResponseFilter, ResponseFilter {
Expand Down Expand Up @@ -133,7 +126,7 @@ layered_runtime:
}

func onError(_ error: EnvoyError, streamIntel: FinalStreamIntel) {
XCTAssertEqual(error.errorCode, 4)
XCTAssertEqual(error.errorCode, 0)
timeoutExpectation.fulfill()
}

Expand Down Expand Up @@ -166,7 +159,7 @@ layered_runtime:
client
.newStreamPrototype()
.setOnError { error, _ in
XCTAssertEqual(error.errorCode, 4)
XCTAssertEqual(error.errorCode, 0)
callbackExpectation.fulfill()
}
.setOnCancel { _ in
Expand Down