graceful_shutdown_test.cc
Go to the documentation of this file.
1 //
2 //
3 // Copyright 2022 gRPC authors.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 //
18 
20 
21 #include <limits.h>
22 #include <stdlib.h>
23 #include <string.h>
24 
25 #include <thread>
26 
27 #include <gmock/gmock.h>
28 
29 #include "absl/synchronization/mutex.h"
30 #include "absl/synchronization/notification.h"
31 
32 #include <grpc/grpc.h>
33 #include <grpc/grpc_posix.h>
34 #include <grpc/grpc_security.h>
35 
48 #include "test/core/util/port.h"
51 
52 namespace grpc_core {
53 namespace {
54 
55 void* Tag(intptr_t t) { return reinterpret_cast<void*>(t); }
56 
57 class GracefulShutdownTest : public ::testing::Test {
58  protected:
59  GracefulShutdownTest() { SetupAndStart(); }
60 
61  ~GracefulShutdownTest() override { ShutdownAndDestroy(); }
62 
63  // Sets up the client and server
64  void SetupAndStart() {
65  ExecCtx exec_ctx;
68  grpc_arg server_args[] = {
70  const_cast<char*>(GRPC_ARG_HTTP2_BDP_PROBE), 0),
72  const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS), INT_MAX)};
73  grpc_channel_args server_channel_args = {GPR_ARRAY_SIZE(server_args),
74  server_args};
75  // Create server
76  server_ = grpc_server_create(&server_channel_args, nullptr);
77  auto* core_server = Server::FromC(server_);
80  fds_ = grpc_iomgr_create_endpoint_pair("fixture", nullptr);
81  auto* transport = grpc_create_chttp2_transport(core_server->channel_args(),
82  fds_.server, false);
84  GPR_ASSERT(core_server->SetupTransport(transport, nullptr,
85  core_server->channel_args(),
86  nullptr) == GRPC_ERROR_NONE);
87  grpc_chttp2_transport_start_reading(transport, nullptr, nullptr, nullptr);
88  // Start polling on the client
89  absl::Notification client_poller_thread_started_notification;
90  client_poll_thread_ = absl::make_unique<std::thread>(
91  [this, &client_poller_thread_started_notification]() {
92  grpc_completion_queue* client_cq =
94  {
95  ExecCtx exec_ctx;
97  grpc_cq_pollset(client_cq));
99  grpc_cq_pollset(client_cq));
100  }
101  client_poller_thread_started_notification.Notify();
102  while (!shutdown_) {
105  nullptr)
107  }
109  });
110  client_poller_thread_started_notification.WaitForNotification();
111  // Write connection prefix and settings frame
112  constexpr char kPrefix[] =
113  "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n\x00\x00\x00\x04\x00\x00\x00\x00\x00";
114  Write(absl::string_view(kPrefix, sizeof(kPrefix) - 1));
115  // Start reading on the client
117  GRPC_CLOSURE_INIT(&on_read_done_, OnReadDone, this, nullptr);
119  /*min_progress_size=*/1);
120  }
121 
122  // Shuts down and destroys the client and server.
123  void ShutdownAndDestroy() {
124  shutdown_ = true;
125  ExecCtx exec_ctx;
127  fds_.client, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Client shutdown"));
128  ExecCtx::Get()->Flush();
129  client_poll_thread_->join();
131  absl::Seconds(5)));
133  ExecCtx::Get()->Flush();
134  // Shutdown and destroy server
136  CQ_EXPECT_COMPLETION(cqv_, Tag(1000), true);
137  cq_verify(cqv_);
141  }
142 
143  static void OnReadDone(void* arg, grpc_error_handle error) {
144  GracefulShutdownTest* self = static_cast<GracefulShutdownTest*>(arg);
145  if (GRPC_ERROR_IS_NONE(error)) {
146  {
147  MutexLock lock(&self->mu_);
148  for (size_t i = 0; i < self->read_buffer_.count; ++i) {
149  absl::StrAppend(&self->read_bytes_,
150  StringViewFromSlice(self->read_buffer_.slices[i]));
151  }
152  self->read_cv_.SignalAll();
153  }
154  grpc_slice_buffer_reset_and_unref(&self->read_buffer_);
155  grpc_endpoint_read(self->fds_.client, &self->read_buffer_,
156  &self->on_read_done_, false, /*min_progress_size=*/1);
157  } else {
158  grpc_slice_buffer_destroy(&self->read_buffer_);
159  self->read_end_notification_.Notify();
160  }
161  }
162 
163  // Waits for \a bytes to show up in read_bytes_
164  void WaitForReadBytes(absl::string_view bytes) {
165  std::atomic<bool> done{false};
166  {
167  MutexLock lock(&mu_);
168  while (!absl::StrContains(read_bytes_, bytes)) {
169  read_cv_.WaitWithTimeout(&mu_, absl::Seconds(5));
170  }
171  }
172  done = true;
173  }
174 
175  void WaitForGoaway(uint32_t last_stream_id, uint32_t error_code = 0,
179  grpc_chttp2_goaway_append(last_stream_id, error_code, slice, &buffer);
180  std::string expected_bytes;
181  for (size_t i = 0; i < buffer.count; ++i) {
182  absl::StrAppend(&expected_bytes, StringViewFromSlice(buffer.slices[i]));
183  }
185  WaitForReadBytes(expected_bytes);
186  }
187 
188  void WaitForPing(uint64_t opaque_data) {
189  grpc_slice ping_slice = grpc_chttp2_ping_create(0, opaque_data);
190  WaitForReadBytes(StringViewFromSlice(ping_slice));
191  }
192 
193  void SendPingAck(uint64_t opaque_data) {
194  grpc_slice ping_slice = grpc_chttp2_ping_create(1, opaque_data);
195  Write(StringViewFromSlice(ping_slice));
196  }
197 
198  // This is a blocking call. It waits for the write callback to be invoked
199  // before returning. (In other words, do not call this from a thread that
200  // should not be blocked, for example, a polling thread.)
202  ExecCtx exec_ctx;
203  grpc_slice slice =
208  WriteBuffer(&buffer);
210  }
211 
212  void WriteBuffer(grpc_slice_buffer* buffer) {
213  absl::Notification on_write_done_notification_;
214  GRPC_CLOSURE_INIT(&on_write_done_, OnWriteDone,
215  &on_write_done_notification_, nullptr);
217  /*max_frame_size=*/INT_MAX);
218  ExecCtx::Get()->Flush();
219  GPR_ASSERT(on_write_done_notification_.WaitForNotificationWithTimeout(
220  absl::Seconds(5)));
221  }
222 
223  static void OnWriteDone(void* arg, grpc_error_handle error) {
225  absl::Notification* on_write_done_notification_ =
226  static_cast<absl::Notification*>(arg);
227  on_write_done_notification_->Notify();
228  }
229 
231  grpc_server* server_ = nullptr;
233  cq_verifier* cqv_ = nullptr;
234  std::unique_ptr<std::thread> client_poll_thread_;
235  std::atomic<bool> shutdown_{false};
238  CondVar read_cv_;
241  std::string read_bytes_ ABSL_GUARDED_BY(mu_);
243 };
244 
245 TEST_F(GracefulShutdownTest, GracefulGoaway) {
246  // Initiate shutdown on the server
248  // Wait for first goaway
249  WaitForGoaway((1u << 31) - 1);
250  // Wait for the ping
251  WaitForPing(0);
252  // Reply to the ping
253  SendPingAck(0);
254  // Wait for final goaway
255  WaitForGoaway(0);
256  // The shutdown should successfully complete.
257  CQ_EXPECT_COMPLETION(cqv_, Tag(1), true);
258  cq_verify(cqv_);
259 }
260 
261 TEST_F(GracefulShutdownTest, RequestStartedBeforeFinalGoaway) {
263  grpc_call* s;
269  &request_metadata_recv, cq_, cq_, Tag(100));
271  // Initiate shutdown on the server
273  // Wait for first goaway
274  WaitForGoaway((1u << 31) - 1);
275  // Wait for the ping
276  WaitForPing(0);
277  // Start a request
278  constexpr char kRequestFrame[] =
279  "\x00\x00\xbe\x01\x05\x00\x00\x00\x01"
280  "\x10\x05:path\x08/foo/bar"
281  "\x10\x07:scheme\x04http"
282  "\x10\x07:method\x04POST"
283  "\x10\x0a:authority\x09localhost"
284  "\x10\x0c"
285  "content-type\x10"
286  "application/grpc"
287  "\x10\x14grpc-accept-encoding\x15identity,deflate,gzip"
288  "\x10\x02te\x08trailers"
289  "\x10\x0auser-agent\x17grpc-c/0.12.0.0 (linux)";
290  Write(absl::string_view(kRequestFrame, sizeof(kRequestFrame) - 1));
291  // Reply to the ping
292  SendPingAck(0);
293  // Wait for final goaway with last stream ID 1 to show that the HTTP2
294  // transport accepted the stream.
295  WaitForGoaway(1);
296  // TODO(yashykt): The surface layer automatically cancels calls received after
297  // shutdown has been called. Once that is fixed, this should be a success.
298  CQ_EXPECT_COMPLETION(cqv_, Tag(100), 0);
299  // The shutdown should successfully complete.
300  CQ_EXPECT_COMPLETION(cqv_, Tag(1), true);
301  cq_verify(cqv_);
304 }
305 
306 TEST_F(GracefulShutdownTest, RequestStartedAfterFinalGoawayIsIgnored) {
307  // Start a request before shutdown to make sure that the connection stays
308  // alive.
310  grpc_call* s;
316  &request_metadata_recv, cq_, cq_, Tag(100));
318  // Send the request from the client.
319  constexpr char kRequestFrame[] =
320  "\x00\x00\xbe\x01\x05\x00\x00\x00\x01"
321  "\x10\x05:path\x08/foo/bar"
322  "\x10\x07:scheme\x04http"
323  "\x10\x07:method\x04POST"
324  "\x10\x0a:authority\x09localhost"
325  "\x10\x0c"
326  "content-type\x10"
327  "application/grpc"
328  "\x10\x14grpc-accept-encoding\x15identity,deflate,gzip"
329  "\x10\x02te\x08trailers"
330  "\x10\x0auser-agent\x17grpc-c/0.12.0.0 (linux)";
331  Write(absl::string_view(kRequestFrame, sizeof(kRequestFrame) - 1));
332  CQ_EXPECT_COMPLETION(cqv_, Tag(100), 1);
333  cq_verify(cqv_);
334 
335  // Initiate shutdown on the server
337  // Wait for first goaway
338  WaitForGoaway((1u << 31) - 1);
339  // Wait for the ping
340  WaitForPing(0);
341  // Reply to the ping
342  SendPingAck(0);
343  // Wait for final goaway
344  WaitForGoaway(1);
345 
346  // Send another request from the client which should be ignored.
347  constexpr char kNewRequestFrame[] =
348  "\x00\x00\xbe\x01\x05\x00\x00\x00\x03"
349  "\x10\x05:path\x08/foo/bar"
350  "\x10\x07:scheme\x04http"
351  "\x10\x07:method\x04POST"
352  "\x10\x0a:authority\x09localhost"
353  "\x10\x0c"
354  "content-type\x10"
355  "application/grpc"
356  "\x10\x14grpc-accept-encoding\x15identity,deflate,gzip"
357  "\x10\x02te\x08trailers"
358  "\x10\x0auser-agent\x17grpc-c/0.12.0.0 (linux)";
359  Write(absl::string_view(kNewRequestFrame, sizeof(kNewRequestFrame) - 1));
360 
361  // Finish the accepted request.
362  grpc_op ops[3];
363  grpc_op* op;
364  memset(ops, 0, sizeof(ops));
365  op = ops;
368  op->flags = 0;
369  op->reserved = nullptr;
370  op++;
374  grpc_slice status_details = grpc_slice_from_static_string("xyz");
375  op->data.send_status_from_server.status_details = &status_details;
376  op->flags = 0;
377  op->reserved = nullptr;
378  op++;
380  int was_cancelled = 2;
382  op->flags = 0;
383  op->reserved = nullptr;
384  op++;
385  error = grpc_call_start_batch(s, ops, static_cast<size_t>(op - ops), Tag(101),
386  nullptr);
388  CQ_EXPECT_COMPLETION(cqv_, Tag(101), true);
389  // The shutdown should successfully complete.
390  CQ_EXPECT_COMPLETION(cqv_, Tag(1), true);
391  cq_verify(cqv_);
392  grpc_call_unref(s);
395 }
396 
397 // Make sure that the graceful goaway eventually makes progress even if a client
398 // does not respond to the ping.
399 TEST_F(GracefulShutdownTest, UnresponsiveClient) {
400  absl::Time initial_time = absl::Now();
401  // Initiate shutdown on the server
403  // Wait for first goaway
404  WaitForGoaway((1u << 31) - 1);
405  // Wait for the ping
406  WaitForPing(0);
407  // Wait for final goaway without sending a ping ACK.
408  WaitForGoaway(0);
409  EXPECT_GE(absl::Now() - initial_time,
410  absl::Seconds(20) -
412  1) /* clock skew between threads due to time caching */);
413  // The shutdown should successfully complete.
414  CQ_EXPECT_COMPLETION(cqv_, Tag(1), true);
415  cq_verify(cqv_);
416 }
417 
418 // Test that servers send a GOAWAY with the last stream ID even when the
419 // transport is disconnected without letting Graceful GOAWAY complete
420 // successfully.
421 TEST_F(GracefulShutdownTest, GoawayReceivedOnServerDisconnect) {
422  // Initiate shutdown on the server and immediately disconnect.
425  // Wait for final goaway.
426  WaitForGoaway(/*last_stream_id=*/0, /*error_code=*/2,
427  grpc_slice_from_static_string("Cancelling all calls"));
428  // The shutdown should successfully complete.
429  CQ_EXPECT_COMPLETION(cqv_, Tag(1), true);
430  cq_verify(cqv_);
431 }
432 
433 } // namespace
434 } // namespace grpc_core
435 
436 int main(int argc, char** argv) {
437  ::testing::InitGoogleTest(&argc, argv);
438  grpc::testing::TestEnvironment env(&argc, argv);
439  grpc_init();
440  int result = RUN_ALL_TESTS();
441  grpc_shutdown();
442  return result;
443 }
main
int main(int argc, char **argv)
Definition: graceful_shutdown_test.cc:436
GRPC_CLOSURE_INIT
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)
Definition: closure.h:115
grpc_arg
Definition: grpc_types.h:103
slice.h
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
grpc_op::flags
uint32_t flags
Definition: grpc_types.h:644
grpc_call_error
grpc_call_error
Definition: grpc_types.h:464
grpc_core::slice_detail::BaseSlice::TakeCSlice
grpc_slice TakeCSlice()
Definition: src/core/lib/slice/slice.h:82
grpc_slice_buffer_destroy
GPRAPI void grpc_slice_buffer_destroy(grpc_slice_buffer *sb)
Definition: slice_buffer_api.cc:27
grpc_call_details_destroy
GRPCAPI void grpc_call_details_destroy(grpc_call_details *details)
Definition: call_details.cc:36
grpc_call_details_init
GRPCAPI void grpc_call_details_init(grpc_call_details *details)
Definition: call_details.cc:30
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition: error.h:234
server_
grpc_server * server_
Definition: graceful_shutdown_test.cc:231
port.h
core_configuration.h
MutexLock
#define MutexLock(x)
Definition: bloaty/third_party/re2/util/mutex.h:125
absl::StrAppend
void StrAppend(std::string *dest, const AlphaNum &a)
Definition: abseil-cpp/absl/strings/str_cat.cc:193
generate.env
env
Definition: generate.py:37
memset
return memset(p, 0, total)
absl::Time
Definition: third_party/abseil-cpp/absl/time/time.h:642
grpc_op::grpc_op_data::send_initial_metadata
struct grpc_op::grpc_op_data::grpc_op_send_initial_metadata send_initial_metadata
grpc_create_chttp2_transport
grpc_transport * grpc_create_chttp2_transport(const grpc_channel_args *channel_args, grpc_endpoint *ep, bool is_client)
Definition: chttp2_transport.cc:3122
grpc_core
Definition: call_metric_recorder.h:31
grpc_metadata_array
Definition: grpc_types.h:579
grpc_call_details
Definition: grpc_types.h:585
grpc_op::reserved
void * reserved
Definition: grpc_types.h:646
string.h
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
grpc_core::StringViewFromSlice
absl::string_view StringViewFromSlice(const grpc_slice &slice)
Definition: slice_internal.h:93
grpc_endpoint_read
void grpc_endpoint_read(grpc_endpoint *ep, grpc_slice_buffer *slices, grpc_closure *cb, bool urgent, int min_progress_size)
Definition: endpoint.cc:25
cq_
grpc_completion_queue * cq_
Definition: graceful_shutdown_test.cc:232
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
error
grpc_error_handle error
Definition: retry_filter.cc:499
grpc_server_create
GRPCAPI grpc_server * grpc_server_create(const grpc_channel_args *args, void *reserved)
Definition: src/core/lib/surface/server.cc:1456
u
OPENSSL_EXPORT pem_password_cb void * u
Definition: pem.h:351
GRPC_CALL_OK
@ GRPC_CALL_OK
Definition: grpc_types.h:466
ABSL_GUARDED_BY
#define ABSL_GUARDED_BY(x)
Definition: abseil-cpp/absl/base/thread_annotations.h:62
on_write_done_
grpc_closure on_write_done_
Definition: graceful_shutdown_test.cc:242
grpc_server_register_completion_queue
GRPCAPI void grpc_server_register_completion_queue(grpc_server *server, grpc_completion_queue *cq, void *reserved)
Definition: src/core/lib/surface/server.cc:1466
grpc_endpoint_pair::server
grpc_endpoint * server
Definition: endpoint_pair.h:28
absl::FormatConversionChar::s
@ s
grpc_security.h
grpc_channel_args
Definition: grpc_types.h:132
testing::Test
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:402
grpc_op::data
union grpc_op::grpc_op_data data
absl::Notification
Definition: abseil-cpp/absl/synchronization/notification.h:66
endpoint_pair.h
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
grpc_metadata_array_destroy
GRPCAPI void grpc_metadata_array_destroy(grpc_metadata_array *array)
Definition: metadata_array.cc:35
grpc_server_request_call
GRPCAPI grpc_call_error grpc_server_request_call(grpc_server *server, grpc_call **call, grpc_call_details *details, grpc_metadata_array *request_metadata, grpc_completion_queue *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void *tag_new)
Definition: src/core/lib/surface/server.cc:1526
mu_
Mutex mu_
Definition: graceful_shutdown_test.cc:237
test_tcp_server.h
grpc_chttp2_goaway_append
void grpc_chttp2_goaway_append(uint32_t last_stream_id, uint32_t error_code, const grpc_slice &debug_data, grpc_slice_buffer *slice_buffer)
Definition: frame_goaway.cc:155
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
GRPC_OP_SEND_STATUS_FROM_SERVER
@ GRPC_OP_SEND_STATUS_FROM_SERVER
Definition: grpc_types.h:612
grpc_core::ExecCtx::Flush
bool Flush()
Definition: exec_ctx.cc:69
on_read_done_
grpc_closure on_read_done_
Definition: graceful_shutdown_test.cc:236
grpc_call_unref
GRPCAPI void grpc_call_unref(grpc_call *call)
Definition: call.cc:1770
grpc_op::grpc_op_data::grpc_op_send_status_from_server::status
grpc_status_code status
Definition: grpc_types.h:673
grpc_timeout_milliseconds_to_deadline
gpr_timespec grpc_timeout_milliseconds_to_deadline(int64_t time_ms)
Definition: test/core/util/test_config.cc:89
slice
grpc_slice slice
Definition: src/core/lib/surface/server.cc:467
grpc_completion_queue
Definition: completion_queue.cc:347
transport
grpc_transport transport
Definition: filter_fuzzer.cc:146
cq_verifier_destroy
void cq_verifier_destroy(cq_verifier *v)
Definition: cq_verifier.cc:92
grpc_slice_buffer_reset_and_unref
GPRAPI void grpc_slice_buffer_reset_and_unref(grpc_slice_buffer *sb)
Definition: slice_buffer_api.cc:32
grpc.h
grpc_call
struct grpc_call grpc_call
Definition: grpc_types.h:70
absl::Notification::Notify
void Notify()
Definition: abseil-cpp/absl/synchronization/notification.cc:27
uint64_t
unsigned __int64 uint64_t
Definition: stdint-msvc2008.h:90
grpc_cq_pollset
grpc_pollset * grpc_cq_pollset(grpc_completion_queue *cq)
Definition: completion_queue.cc:1433
opencensus.proto.stats.v1.stats_pb2.Tag
Tag
Definition: stats_pb2.py:431
frame_goaway.h
done
struct tab * done
Definition: bloaty/third_party/zlib/examples/enough.c:176
grpc_op
Definition: grpc_types.h:640
arg
Definition: cmdline.cc:40
grpc_slice_from_static_string
GPRAPI grpc_slice grpc_slice_from_static_string(const char *source)
Definition: slice/slice.cc:89
cq_verifier_create
cq_verifier * cq_verifier_create(grpc_completion_queue *cq)
Definition: cq_verifier.cc:86
was_cancelled
static int was_cancelled
Definition: test/core/fling/server.cc:58
grpc_core::TEST_F
TEST_F(AuthorizationMatchersTest, AlwaysAuthorizationMatcher)
Definition: authorization_matchers_test.cc:35
grpc_empty_slice
GPRAPI grpc_slice grpc_empty_slice(void)
Definition: slice/slice.cc:42
grpc_slice
Definition: include/grpc/impl/codegen/slice.h:65
absl::StrContains
ABSL_NAMESPACE_BEGIN bool StrContains(absl::string_view haystack, absl::string_view needle) noexcept
Definition: third_party/abseil-cpp/absl/strings/match.h:46
grpc_server
struct grpc_server grpc_server
Definition: grpc_types.h:65
cqv_
cq_verifier * cqv_
Definition: graceful_shutdown_test.cc:233
intptr_t
_W64 signed int intptr_t
Definition: stdint-msvc2008.h:118
cq_verifier
Definition: cq_verifier.cc:76
request_metadata_recv
static grpc_metadata_array request_metadata_recv
Definition: test/core/fling/server.cc:48
grpc_posix.h
frame_ping.h
grpc_endpoint_shutdown
void grpc_endpoint_shutdown(grpc_endpoint *ep, grpc_error_handle why)
Definition: endpoint.cc:49
grpc_server_destroy
GRPCAPI void grpc_server_destroy(grpc_server *server)
Definition: src/core/lib/surface/server.cc:1519
host_port.h
CQ_EXPECT_COMPLETION
#define CQ_EXPECT_COMPLETION(v, tag, success)
Definition: cq_verifier.h:58
grpc_chttp2_ping_create
grpc_slice grpc_chttp2_ping_create(uint8_t ack, uint64_t opaque_8bytes)
Definition: frame_ping.cc:39
buffer
char buffer[1024]
Definition: libuv/docs/code/idle-compute/main.c:8
RUN_ALL_TESTS
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2471
grpc_endpoint_destroy
void grpc_endpoint_destroy(grpc_endpoint *ep)
Definition: endpoint.cc:53
grpc_slice_buffer_init
GPRAPI void grpc_slice_buffer_init(grpc_slice_buffer *sb)
Definition: slice/slice_buffer.cc:116
grpc_op::op
grpc_op_type op
Definition: grpc_types.h:642
GRPC_ERROR_CREATE_FROM_STATIC_STRING
#define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc)
Definition: error.h:291
grpc_server_cancel_all_calls
GRPCAPI void grpc_server_cancel_all_calls(grpc_server *server)
Definition: src/core/lib/surface/server.cc:1512
grpc_op::grpc_op_data::grpc_op_send_initial_metadata::count
size_t count
Definition: grpc_types.h:653
test_config.h
fds_
grpc_endpoint_pair fds_
Definition: graceful_shutdown_test.cc:230
grpc_op::grpc_op_data::recv_close_on_server
struct grpc_op::grpc_op_data::grpc_op_recv_close_on_server recv_close_on_server
absl::Seconds
constexpr Duration Seconds(T n)
Definition: third_party/abseil-cpp/absl/time/time.h:419
absl::Now
ABSL_NAMESPACE_BEGIN Time Now()
Definition: abseil-cpp/absl/time/clock.cc:39
GPR_ARRAY_SIZE
#define GPR_ARRAY_SIZE(array)
Definition: useful.h:129
grpc_slice_buffer_add
GPRAPI void grpc_slice_buffer_add(grpc_slice_buffer *sb, grpc_slice slice)
Definition: slice/slice_buffer.cc:170
read_cv_
CondVar read_cv_
Definition: graceful_shutdown_test.cc:238
testing::InitGoogleTest
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Definition: bloaty/third_party/googletest/googletest/src/gtest.cc:6106
grpc_op::grpc_op_data::send_status_from_server
struct grpc_op::grpc_op_data::grpc_op_send_status_from_server send_status_from_server
testing::internal::posix::Write
int Write(int fd, const void *buf, unsigned int count)
Definition: bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:2047
grpc_core::slice_detail::StaticConstructors< StaticSlice >::FromStaticBuffer
static StaticSlice FromStaticBuffer(const void *s, size_t len)
Definition: src/core/lib/slice/slice.h:209
grpc_channel_arg_integer_create
grpc_arg grpc_channel_arg_integer_create(char *name, int value)
Definition: channel_args.cc:484
bytes
uint8 bytes[10]
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream_unittest.cc:153
cq_verifier.h
grpc_completion_queue_destroy
GRPCAPI void grpc_completion_queue_destroy(grpc_completion_queue *cq)
Definition: completion_queue.cc:1424
read_end_notification_
absl::Notification read_end_notification_
Definition: graceful_shutdown_test.cc:239
shutdown_
std::atomic< bool > shutdown_
Definition: graceful_shutdown_test.cc:235
GRPC_OP_SEND_INITIAL_METADATA
@ GRPC_OP_SEND_INITIAL_METADATA
Definition: grpc_types.h:598
exec_ctx
grpc_core::ExecCtx exec_ctx
Definition: end2end_binder_transport_test.cc:75
grpc_endpoint_pair::client
grpc_endpoint * client
Definition: endpoint_pair.h:27
absl::str_format_internal::LengthMod::t
@ t
google::protobuf.internal::Mutex
WrappedMutex Mutex
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/mutex.h:113
grpc_iomgr_create_endpoint_pair
grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char *name, grpc_channel_args *args)
grpc_op::grpc_op_data::grpc_op_send_status_from_server::trailing_metadata_count
size_t trailing_metadata_count
Definition: grpc_types.h:671
grpc::testing::TestEnvironment
Definition: test/core/util/test_config.h:54
chttp2_transport.h
grpc_server_shutdown_and_notify
GRPCAPI void grpc_server_shutdown_and_notify(grpc_server *server, grpc_completion_queue *cq, void *tag)
Definition: src/core/lib/surface/server.cc:1503
GRPC_ARG_HTTP2_BDP_PROBE
#define GRPC_ARG_HTTP2_BDP_PROBE
Definition: grpc_types.h:204
grpc_completion_queue_next
GRPCAPI grpc_event grpc_completion_queue_next(grpc_completion_queue *cq, gpr_timespec deadline, void *reserved)
Definition: completion_queue.cc:1133
cq_verify
void cq_verify(cq_verifier *v, int timeout_sec)
Definition: cq_verifier.cc:268
arg
struct arg arg
server.h
read_buffer_
grpc_slice_buffer read_buffer_
Definition: graceful_shutdown_test.cc:240
EXPECT_GE
#define EXPECT_GE(val1, val2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2034
GRPC_OP_RECV_CLOSE_ON_SERVER
@ GRPC_OP_RECV_CLOSE_ON_SERVER
Definition: grpc_types.h:633
GRPC_STATUS_UNIMPLEMENTED
@ GRPC_STATUS_UNIMPLEMENTED
Definition: include/grpc/impl/codegen/status.h:124
grpc_endpoint_write
void grpc_endpoint_write(grpc_endpoint *ep, grpc_slice_buffer *slices, grpc_closure *cb, void *arg, int max_frame_size)
Definition: endpoint.cc:30
absl::Notification::WaitForNotificationWithTimeout
bool WaitForNotificationWithTimeout(absl::Duration timeout) const
Definition: abseil-cpp/absl/synchronization/notification.cc:56
client_poll_thread_
std::unique_ptr< std::thread > client_poll_thread_
Definition: graceful_shutdown_test.cc:234
grpc_slice_buffer
Definition: include/grpc/impl/codegen/slice.h:83
grpc_completion_queue_create_for_next
GRPCAPI grpc_completion_queue * grpc_completion_queue_create_for_next(void *reserved)
Definition: completion_queue_factory.cc:62
grpc_op::grpc_op_data::grpc_op_send_status_from_server::status_details
grpc_slice * status_details
Definition: grpc_types.h:677
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
GRPC_ARG_KEEPALIVE_TIME_MS
#define GRPC_ARG_KEEPALIVE_TIME_MS
Definition: grpc_types.h:240
grpc_init
GRPCAPI void grpc_init(void)
Definition: init.cc:146
grpc_server_start
GRPCAPI void grpc_server_start(grpc_server *server)
Definition: src/core/lib/surface/server.cc:1497
grpc_error
Definition: error_internal.h:42
self
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END intern self
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/map.c:543
grpc_endpoint_pair
Definition: endpoint_pair.h:26
grpc_endpoint_add_to_pollset
void grpc_endpoint_add_to_pollset(grpc_endpoint *ep, grpc_pollset *pollset)
Definition: endpoint.cc:35
grpc_core::CppImplOf< Server, grpc_server >::FromC
static Server * FromC(grpc_server *c_type)
Definition: cpp_impl_of.h:30
channel_stack_builder.h
grpc_closure
Definition: closure.h:56
op
static grpc_op * op
Definition: test/core/fling/client.cc:47
ops
static grpc_op ops[6]
Definition: test/core/fling/client.cc:39
GRPC_QUEUE_TIMEOUT
@ GRPC_QUEUE_TIMEOUT
Definition: grpc_types.h:556
grpc_call_start_batch
GRPCAPI grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops, size_t nops, void *tag, void *reserved)
Definition: call.cc:1831
grpc_shutdown
GRPCAPI void grpc_shutdown(void)
Definition: init.cc:209
grpc_op::grpc_op_data::grpc_op_recv_close_on_server::cancelled
int * cancelled
Definition: grpc_types.h:714
grpc_chttp2_transport_start_reading
void grpc_chttp2_transport_start_reading(grpc_transport *transport, grpc_slice_buffer *read_buffer, grpc_closure *notify_on_receive_settings, grpc_closure *notify_on_close)
Definition: chttp2_transport.cc:3128
grpc_core::ExecCtx::Get
static ExecCtx * Get()
Definition: exec_ctx.h:205
slice_string_helpers.h
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
call_details
static grpc_call_details call_details
Definition: test/core/fling/server.cc:47
grpc_metadata_array_init
GRPCAPI void grpc_metadata_array_init(grpc_metadata_array *array)
Definition: metadata_array.cc:30
absl::Notification::WaitForNotification
void WaitForNotification() const
Definition: abseil-cpp/absl/synchronization/notification.cc:48
GRPC_ERROR_IS_NONE
#define GRPC_ERROR_IS_NONE(err)
Definition: error.h:241
channel.h
port_platform.h


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:44