Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ext_proc fuzzer test exposed a race issue which leads to ENVOY_BUG #27639

Merged
Prev Previous commit
Next Next commit
adding stream_ check
Signed-off-by: Yanjun Xiang <[email protected]>
yanjunxiang-google committed May 31, 2023
commit 3bfe6447723f4c702e1d51b1c0c957666ab3265e
6 changes: 4 additions & 2 deletions source/extensions/filters/http/ext_proc/ext_proc.cc
Original file line number Diff line number Diff line change
@@ -120,14 +120,16 @@ void Filter::setEncoderFilterCallbacks(Http::StreamEncoderFilterCallbacks& callb
Filter::StreamOpenState Filter::openStream() {
// If processing already completes, no need to open a gRPC stream.
if (processing_complete_) {
// Stream failed while starting and either onGrpcError or onGrpcClose was already called
return sent_immediate_response_ ? StreamOpenState::Error : StreamOpenState::IgnoreError;
}
if (!stream_) {
ENVOY_LOG(debug, "Opening gRPC stream to external processor");
stream_ = client_->start(*this, grpc_service_, decoder_callbacks_->streamInfo());
stats_.streams_started_.inc();
if (stream_ == nullptr) {
return config_->failureModeAllow() ? StreamOpenState::IgnoreError : StreamOpenState::Error;
}

stats_.streams_started_.inc();
// For custom access logging purposes. Applicable only for Envoy gRPC as Google gRPC does not
// have a proper implementation of streamInfo.
if (grpc_service_.has_envoy_grpc()) {