|
|
|
@ -24,6 +24,7 @@ |
|
|
|
|
#include "absl/base/attributes.h" |
|
|
|
|
#include "absl/functional/function_ref.h" |
|
|
|
|
#include "absl/strings/str_cat.h" |
|
|
|
|
#include "absl/strings/str_format.h" |
|
|
|
|
#include "absl/strings/str_join.h" |
|
|
|
|
#include "absl/types/variant.h" |
|
|
|
|
|
|
|
|
@ -31,6 +32,7 @@ |
|
|
|
|
|
|
|
|
|
#include "src/core/lib/channel/channel_stack.h" |
|
|
|
|
#include "src/core/lib/debug/trace.h" |
|
|
|
|
#include "src/core/lib/gprpp/crash.h" |
|
|
|
|
#include "src/core/lib/gprpp/manual_constructor.h" |
|
|
|
|
#include "src/core/lib/gprpp/status_helper.h" |
|
|
|
|
#include "src/core/lib/iomgr/error.h" |
|
|
|
@ -318,8 +320,7 @@ void BaseCallData::SendMessage::StartOp(CapturedBatch batch) { |
|
|
|
|
case State::kForwardedBatch: |
|
|
|
|
case State::kBatchCompleted: |
|
|
|
|
case State::kPushedToPipe: |
|
|
|
|
gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", StateString(state_)); |
|
|
|
|
abort(); |
|
|
|
|
Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_))); |
|
|
|
|
case State::kCancelled: |
|
|
|
|
case State::kCancelledButNotYetPolled: |
|
|
|
|
return; |
|
|
|
@ -348,8 +349,7 @@ void BaseCallData::SendMessage::GotPipe(PipeReceiver<MessageHandle>* receiver) { |
|
|
|
|
case State::kForwardedBatch: |
|
|
|
|
case State::kBatchCompleted: |
|
|
|
|
case State::kPushedToPipe: |
|
|
|
|
gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", StateString(state_)); |
|
|
|
|
abort(); |
|
|
|
|
Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_))); |
|
|
|
|
case State::kCancelled: |
|
|
|
|
case State::kCancelledButNotYetPolled: |
|
|
|
|
return; |
|
|
|
@ -388,8 +388,7 @@ void BaseCallData::SendMessage::OnComplete(absl::Status status) { |
|
|
|
|
case State::kPushedToPipe: |
|
|
|
|
case State::kGotBatch: |
|
|
|
|
case State::kBatchCompleted: |
|
|
|
|
gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", StateString(state_)); |
|
|
|
|
abort(); |
|
|
|
|
Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_))); |
|
|
|
|
break; |
|
|
|
|
case State::kCancelled: |
|
|
|
|
case State::kCancelledButNotYetPolled: |
|
|
|
@ -422,8 +421,7 @@ void BaseCallData::SendMessage::Done(const ServerMetadata& metadata) { |
|
|
|
|
case State::kGotBatchNoPipe: |
|
|
|
|
case State::kGotBatch: |
|
|
|
|
case State::kBatchCompleted: |
|
|
|
|
gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", StateString(state_)); |
|
|
|
|
abort(); |
|
|
|
|
Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_))); |
|
|
|
|
break; |
|
|
|
|
case State::kPushedToPipe: |
|
|
|
|
push_.reset(); |
|
|
|
@ -574,8 +572,7 @@ void BaseCallData::ReceiveMessage::StartOp(CapturedBatch& batch) { |
|
|
|
|
case State::kPulledFromPipe: |
|
|
|
|
case State::kCompletedWhilePulledFromPipe: |
|
|
|
|
case State::kCompletedWhilePushedToPipe: |
|
|
|
|
gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", StateString(state_)); |
|
|
|
|
abort(); |
|
|
|
|
Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_))); |
|
|
|
|
case State::kCancelledWhilstIdle: |
|
|
|
|
case State::kCancelled: |
|
|
|
|
return; |
|
|
|
@ -616,8 +613,7 @@ void BaseCallData::ReceiveMessage::GotPipe(PipeSender<MessageHandle>* sender) { |
|
|
|
|
case State::kCancelledWhilstForwarding: |
|
|
|
|
case State::kCancelledWhilstIdle: |
|
|
|
|
case State::kBatchCompletedButCancelled: |
|
|
|
|
gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", StateString(state_)); |
|
|
|
|
abort(); |
|
|
|
|
Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_))); |
|
|
|
|
case State::kCancelled: |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -642,8 +638,7 @@ void BaseCallData::ReceiveMessage::OnComplete(absl::Status status) { |
|
|
|
|
case State::kCancelledWhilstIdle: |
|
|
|
|
case State::kCompletedWhilePulledFromPipe: |
|
|
|
|
case State::kCompletedWhilePushedToPipe: |
|
|
|
|
gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", StateString(state_)); |
|
|
|
|
abort(); |
|
|
|
|
Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_))); |
|
|
|
|
case State::kForwardedBatchNoPipe: |
|
|
|
|
state_ = State::kBatchCompletedNoPipe; |
|
|
|
|
return; |
|
|
|
@ -702,8 +697,7 @@ void BaseCallData::ReceiveMessage::Done(const ServerMetadata& metadata, |
|
|
|
|
case State::kBatchCompleted: |
|
|
|
|
case State::kBatchCompletedNoPipe: |
|
|
|
|
case State::kBatchCompletedButCancelled: |
|
|
|
|
gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", StateString(state_)); |
|
|
|
|
abort(); |
|
|
|
|
Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_))); |
|
|
|
|
case State::kCancelledWhilstIdle: |
|
|
|
|
case State::kCancelledWhilstForwarding: |
|
|
|
|
case State::kCancelled: |
|
|
|
@ -994,10 +988,10 @@ class ClientCallData::PollContext { |
|
|
|
|
case RecvInitialMetadata:: |
|
|
|
|
kRespondedToTrailingMetadataPriorToHook: |
|
|
|
|
case RecvInitialMetadata::kRespondedButNeedToSetLatch: |
|
|
|
|
gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", |
|
|
|
|
RecvInitialMetadata::StateString( |
|
|
|
|
self_->recv_initial_metadata_->state)); |
|
|
|
|
abort(); // not reachable
|
|
|
|
|
Crash(absl::StrFormat("ILLEGAL STATE: %s", |
|
|
|
|
RecvInitialMetadata::StateString( |
|
|
|
|
self_->recv_initial_metadata_ |
|
|
|
|
->state))); // not reachable
|
|
|
|
|
break; |
|
|
|
|
case RecvInitialMetadata::kHookedWaitingForLatch: |
|
|
|
|
case RecvInitialMetadata::kHookedAndGotLatch: |
|
|
|
@ -1033,10 +1027,10 @@ class ClientCallData::PollContext { |
|
|
|
|
case RecvInitialMetadata:: |
|
|
|
|
kRespondedToTrailingMetadataPriorToHook: |
|
|
|
|
case RecvInitialMetadata::kRespondedButNeedToSetLatch: |
|
|
|
|
gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", |
|
|
|
|
RecvInitialMetadata::StateString( |
|
|
|
|
self_->recv_initial_metadata_->state)); |
|
|
|
|
abort(); // not reachable
|
|
|
|
|
Crash(absl::StrFormat("ILLEGAL STATE: %s", |
|
|
|
|
RecvInitialMetadata::StateString( |
|
|
|
|
self_->recv_initial_metadata_ |
|
|
|
|
->state))); // not reachable
|
|
|
|
|
break; |
|
|
|
|
case RecvInitialMetadata::kCompleteWaitingForLatch: |
|
|
|
|
case RecvInitialMetadata::kCompleteAndGotLatch: |
|
|
|
@ -1263,10 +1257,10 @@ void ClientCallData::StartBatch(grpc_transport_stream_op_batch* b) { |
|
|
|
|
case RecvInitialMetadata::kCompleteAndSetLatch: |
|
|
|
|
case RecvInitialMetadata::kResponded: |
|
|
|
|
case RecvInitialMetadata::kRespondedButNeedToSetLatch: |
|
|
|
|
gpr_log( |
|
|
|
|
GPR_ERROR, "ILLEGAL STATE: %s", |
|
|
|
|
RecvInitialMetadata::StateString(recv_initial_metadata_->state)); |
|
|
|
|
abort(); // unreachable
|
|
|
|
|
Crash(absl::StrFormat( |
|
|
|
|
"ILLEGAL STATE: %s", |
|
|
|
|
RecvInitialMetadata::StateString( |
|
|
|
|
recv_initial_metadata_->state))); // unreachable
|
|
|
|
|
} |
|
|
|
|
if (hook) { |
|
|
|
|
auto cb = [](void* ptr, grpc_error_handle error) { |
|
|
|
@ -1383,10 +1377,9 @@ void ClientCallData::Cancel(grpc_error_handle error, Flusher* flusher) { |
|
|
|
|
case RecvInitialMetadata::kResponded: |
|
|
|
|
break; |
|
|
|
|
case RecvInitialMetadata::kRespondedButNeedToSetLatch: |
|
|
|
|
gpr_log( |
|
|
|
|
GPR_ERROR, "ILLEGAL STATE: %s", |
|
|
|
|
RecvInitialMetadata::StateString(recv_initial_metadata_->state)); |
|
|
|
|
abort(); |
|
|
|
|
Crash(absl::StrFormat( |
|
|
|
|
"ILLEGAL STATE: %s", |
|
|
|
|
RecvInitialMetadata::StateString(recv_initial_metadata_->state))); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1441,10 +1434,10 @@ void ClientCallData::RecvInitialMetadataReady(grpc_error_handle error) { |
|
|
|
|
case RecvInitialMetadata::kResponded: |
|
|
|
|
case RecvInitialMetadata::kRespondedToTrailingMetadataPriorToHook: |
|
|
|
|
case RecvInitialMetadata::kRespondedButNeedToSetLatch: |
|
|
|
|
gpr_log( |
|
|
|
|
GPR_ERROR, "ILLEGAL STATE: %s", |
|
|
|
|
RecvInitialMetadata::StateString(recv_initial_metadata_->state)); |
|
|
|
|
abort(); // unreachable
|
|
|
|
|
Crash(absl::StrFormat( |
|
|
|
|
"ILLEGAL STATE: %s", |
|
|
|
|
RecvInitialMetadata::StateString( |
|
|
|
|
recv_initial_metadata_->state))); // unreachable
|
|
|
|
|
} |
|
|
|
|
flusher.AddClosure( |
|
|
|
|
std::exchange(recv_initial_metadata_->original_on_ready, nullptr), |
|
|
|
@ -1473,10 +1466,10 @@ void ClientCallData::RecvInitialMetadataReady(grpc_error_handle error) { |
|
|
|
|
case RecvInitialMetadata::kResponded: |
|
|
|
|
case RecvInitialMetadata::kRespondedToTrailingMetadataPriorToHook: |
|
|
|
|
case RecvInitialMetadata::kRespondedButNeedToSetLatch: |
|
|
|
|
gpr_log( |
|
|
|
|
GPR_ERROR, "ILLEGAL STATE: %s", |
|
|
|
|
RecvInitialMetadata::StateString(recv_initial_metadata_->state)); |
|
|
|
|
abort(); // unreachable
|
|
|
|
|
Crash(absl::StrFormat( |
|
|
|
|
"ILLEGAL STATE: %s", |
|
|
|
|
RecvInitialMetadata::StateString( |
|
|
|
|
recv_initial_metadata_->state))); // unreachable
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
WakeInsideCombiner(&flusher); |
|
|
|
@ -1537,10 +1530,10 @@ ArenaPromise<ServerMetadataHandle> ClientCallData::MakeNextPromise( |
|
|
|
|
case RecvInitialMetadata::kResponded: |
|
|
|
|
case RecvInitialMetadata::kRespondedToTrailingMetadataPriorToHook: |
|
|
|
|
case RecvInitialMetadata::kRespondedButNeedToSetLatch: |
|
|
|
|
gpr_log( |
|
|
|
|
GPR_ERROR, "ILLEGAL STATE: %s", |
|
|
|
|
RecvInitialMetadata::StateString(recv_initial_metadata_->state)); |
|
|
|
|
abort(); // unreachable
|
|
|
|
|
Crash(absl::StrFormat( |
|
|
|
|
"ILLEGAL STATE: %s", |
|
|
|
|
RecvInitialMetadata::StateString( |
|
|
|
|
recv_initial_metadata_->state))); // unreachable
|
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
GPR_ASSERT(call_args.server_initial_metadata == nullptr); |
|
|
|
@ -1602,9 +1595,8 @@ Poll<ServerMetadataHandle> ClientCallData::PollTrailingMetadata() { |
|
|
|
|
case RecvTrailingState::kResponded: |
|
|
|
|
// We've already responded to the caller: we can't do anything and we
|
|
|
|
|
// should never reach here.
|
|
|
|
|
gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", |
|
|
|
|
StateString(recv_trailing_state_)); |
|
|
|
|
abort(); |
|
|
|
|
Crash(absl::StrFormat("ILLEGAL STATE: %s", |
|
|
|
|
StateString(recv_trailing_state_))); |
|
|
|
|
} |
|
|
|
|
GPR_UNREACHABLE_CODE(return Pending{}); |
|
|
|
|
} |
|
|
|
@ -1903,10 +1895,10 @@ void ServerCallData::StartBatch(grpc_transport_stream_op_batch* b) { |
|
|
|
|
case SendInitialMetadata::kQueuedWaitingForLatch: |
|
|
|
|
case SendInitialMetadata::kQueuedAndSetLatch: |
|
|
|
|
case SendInitialMetadata::kForwarded: |
|
|
|
|
gpr_log( |
|
|
|
|
GPR_ERROR, "ILLEGAL STATE: %s", |
|
|
|
|
SendInitialMetadata::StateString(send_initial_metadata_->state)); |
|
|
|
|
abort(); // not reachable
|
|
|
|
|
Crash(absl::StrFormat( |
|
|
|
|
"ILLEGAL STATE: %s", |
|
|
|
|
SendInitialMetadata::StateString( |
|
|
|
|
send_initial_metadata_->state))); // not reachable
|
|
|
|
|
} |
|
|
|
|
send_initial_metadata_->batch = batch; |
|
|
|
|
wake = true; |
|
|
|
@ -1942,9 +1934,9 @@ void ServerCallData::StartBatch(grpc_transport_stream_op_batch* b) { |
|
|
|
|
case SendTrailingState::kQueued: |
|
|
|
|
case SendTrailingState::kQueuedBehindSendMessage: |
|
|
|
|
case SendTrailingState::kForwarded: |
|
|
|
|
gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", |
|
|
|
|
StateString(send_trailing_state_)); |
|
|
|
|
abort(); // unreachable
|
|
|
|
|
Crash( |
|
|
|
|
absl::StrFormat("ILLEGAL STATE: %s", |
|
|
|
|
StateString(send_trailing_state_))); // unreachable
|
|
|
|
|
break; |
|
|
|
|
case SendTrailingState::kCancelled: |
|
|
|
|
batch.CancelWith( |
|
|
|
@ -2022,10 +2014,10 @@ ArenaPromise<ServerMetadataHandle> ServerCallData::MakeNextPromise( |
|
|
|
|
case SendInitialMetadata::kQueuedAndGotLatch: |
|
|
|
|
case SendInitialMetadata::kQueuedAndSetLatch: |
|
|
|
|
case SendInitialMetadata::kForwarded: |
|
|
|
|
gpr_log( |
|
|
|
|
GPR_ERROR, "ILLEGAL STATE: %s", |
|
|
|
|
SendInitialMetadata::StateString(send_initial_metadata_->state)); |
|
|
|
|
abort(); // not reachable
|
|
|
|
|
Crash(absl::StrFormat( |
|
|
|
|
"ILLEGAL STATE: %s", |
|
|
|
|
SendInitialMetadata::StateString( |
|
|
|
|
send_initial_metadata_->state))); // not reachable
|
|
|
|
|
break; |
|
|
|
|
case SendInitialMetadata::kQueuedWaitingForLatch: |
|
|
|
|
send_initial_metadata_->state = SendInitialMetadata::kQueuedAndGotLatch; |
|
|
|
@ -2062,9 +2054,8 @@ Poll<ServerMetadataHandle> ServerCallData::PollTrailingMetadata() { |
|
|
|
|
return WrapMetadata(send_trailing_metadata_batch_->payload |
|
|
|
|
->send_trailing_metadata.send_trailing_metadata); |
|
|
|
|
case SendTrailingState::kForwarded: |
|
|
|
|
gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", |
|
|
|
|
StateString(send_trailing_state_)); |
|
|
|
|
abort(); // unreachable
|
|
|
|
|
Crash(absl::StrFormat("ILLEGAL STATE: %s", |
|
|
|
|
StateString(send_trailing_state_))); // unreachable
|
|
|
|
|
case SendTrailingState::kCancelled: |
|
|
|
|
// We could translate cancelled_error to metadata and return it... BUT
|
|
|
|
|
// we're not gonna be running much longer and the results going to be
|
|
|
|
@ -2233,9 +2224,9 @@ void ServerCallData::WakeInsideCombiner(Flusher* flusher) { |
|
|
|
|
send_trailing_state_ = SendTrailingState::kForwarded; |
|
|
|
|
} break; |
|
|
|
|
case SendTrailingState::kForwarded: |
|
|
|
|
gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", |
|
|
|
|
StateString(send_trailing_state_)); |
|
|
|
|
abort(); // unreachable
|
|
|
|
|
Crash(absl::StrFormat( |
|
|
|
|
"ILLEGAL STATE: %s", |
|
|
|
|
StateString(send_trailing_state_))); // unreachable
|
|
|
|
|
break; |
|
|
|
|
case SendTrailingState::kInitial: { |
|
|
|
|
GPR_ASSERT(*md->get_pointer(GrpcStatusMetadata()) != GRPC_STATUS_OK); |
|
|
|
|