grpc 1.72.0-x86-mingw32 → 1.74.0.pre2-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,9 +26,6 @@
26
26
  /* Initializes the Channel class. */
27
27
  void Init_grpc_channel();
28
28
 
29
- void grpc_rb_channel_polling_thread_start();
30
- void grpc_rb_channel_polling_thread_stop();
31
-
32
29
  /* Gets the wrapped channel from the ruby wrapper */
33
30
  grpc_channel* grpc_rb_get_wrapped_channel(VALUE v);
34
31
 
@@ -34,15 +34,22 @@ typedef struct next_call_stack {
34
34
  grpc_event event;
35
35
  gpr_timespec timeout;
36
36
  void* tag;
37
- void (*unblock_func)(void*);
38
- void* unblock_func_arg;
37
+ volatile int interrupted;
39
38
  } next_call_stack;
40
39
 
41
40
  /* Calls grpc_completion_queue_pluck without holding the ruby GIL */
42
41
  static void* grpc_rb_completion_queue_pluck_no_gil(void* param) {
43
42
  next_call_stack* const next_call = (next_call_stack*)param;
44
- next_call->event = grpc_completion_queue_pluck(next_call->cq, next_call->tag,
45
- next_call->timeout, NULL);
43
+ gpr_timespec increment = gpr_time_from_millis(200, GPR_TIMESPAN);
44
+ gpr_timespec deadline;
45
+ for (;;) {
46
+ deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), increment);
47
+ next_call->event = grpc_completion_queue_pluck(
48
+ next_call->cq, next_call->tag, deadline, NULL);
49
+ if (next_call->event.type != GRPC_QUEUE_TIMEOUT) break;
50
+ if (gpr_time_cmp(deadline, next_call->timeout) > 0) break;
51
+ if (next_call->interrupted) break;
52
+ }
46
53
  return NULL;
47
54
  }
48
55
 
@@ -56,28 +63,33 @@ void grpc_rb_completion_queue_destroy(grpc_completion_queue* cq) {
56
63
  grpc_completion_queue_destroy(cq);
57
64
  }
58
65
 
59
- static void outer_unblock_func(void* param) {
66
+ static void unblock_func(void* param) {
60
67
  next_call_stack* const next_call = (next_call_stack*)param;
61
- if (next_call->unblock_func == NULL) return;
62
- next_call->unblock_func(next_call->unblock_func_arg);
68
+ next_call->interrupted = 1;
63
69
  }
64
70
 
65
71
  /* Does the same thing as grpc_completion_queue_pluck, while properly releasing
66
72
  the GVL and handling interrupts */
67
73
  grpc_event rb_completion_queue_pluck(grpc_completion_queue* queue, void* tag,
68
74
  gpr_timespec deadline,
69
- void (*unblock_func)(void* param),
70
- void* unblock_func_arg) {
75
+ const char* reason) {
71
76
  next_call_stack next_call;
72
77
  MEMZERO(&next_call, next_call_stack, 1);
73
78
  next_call.cq = queue;
74
79
  next_call.timeout = deadline;
75
80
  next_call.tag = tag;
76
81
  next_call.event.type = GRPC_QUEUE_TIMEOUT;
77
- next_call.unblock_func = unblock_func;
78
- next_call.unblock_func_arg = unblock_func_arg;
79
- rb_thread_call_without_gvl(grpc_rb_completion_queue_pluck_no_gil,
80
- (void*)&next_call, outer_unblock_func,
81
- (void*)&next_call);
82
+ /* Loop until we finish a pluck without an interruption. See
83
+ * https://github.com/grpc/grpc/issues/38210 for an example of why
84
+ * this is necessary. */
85
+ grpc_absl_log_str(GPR_DEBUG, "CQ pluck loop begin: ", reason);
86
+ do {
87
+ next_call.interrupted = 0;
88
+ rb_thread_call_without_gvl(grpc_rb_completion_queue_pluck_no_gil,
89
+ (void*)&next_call, unblock_func,
90
+ (void*)&next_call);
91
+ if (next_call.event.type != GRPC_QUEUE_TIMEOUT) break;
92
+ } while (next_call.interrupted);
93
+ grpc_absl_log_str(GPR_DEBUG, "CQ pluck loop done: ", reason);
82
94
  return next_call.event;
83
95
  }
@@ -29,14 +29,8 @@ void grpc_rb_completion_queue_destroy(grpc_completion_queue* cq);
29
29
  * Makes the implementation of CompletionQueue#pluck available in other files
30
30
  *
31
31
  * This avoids having code that holds the GIL repeated at multiple sites.
32
- *
33
- * unblock_func is invoked with the provided argument to unblock the CQ
34
- * operation in the event of process termination (e.g. a signal), but
35
- * unblock_func may be NULL in which case it's unused.
36
32
  */
37
33
  grpc_event rb_completion_queue_pluck(grpc_completion_queue* queue, void* tag,
38
- gpr_timespec deadline,
39
- void (*unblock_func)(void* param),
40
- void* unblock_func_arg);
34
+ gpr_timespec deadline, const char* reason);
41
35
 
42
36
  #endif /* GRPC_RB_COMPLETION_QUEUE_H_ */
@@ -333,7 +333,6 @@ static void grpc_ruby_init_threads() {
333
333
  rb_mutex_lock(g_bg_thread_init_rb_mu);
334
334
  if (!g_bg_thread_init_done) {
335
335
  grpc_rb_event_queue_thread_start();
336
- grpc_rb_channel_polling_thread_start();
337
336
  g_bg_thread_init_done = true;
338
337
  }
339
338
  rb_mutex_unlock(g_bg_thread_init_rb_mu);
@@ -381,7 +380,7 @@ static VALUE grpc_rb_prefork(VALUE self) {
381
380
  rb_raise(rb_eRuntimeError,
382
381
  "GRPC.prefork and fork need to be called from the same thread "
383
382
  "that GRPC was initialized on (GRPC lazy-initializes when when "
384
- "the first GRPC object is created");
383
+ "the first GRPC object is created)");
385
384
  }
386
385
  if (g_grpc_rb_num_fork_unsafe_threads > 0) {
387
386
  rb_raise(
@@ -395,7 +394,6 @@ static VALUE grpc_rb_prefork(VALUE self) {
395
394
  g_grpc_rb_prefork_pending = true;
396
395
  rb_mutex_lock(g_bg_thread_init_rb_mu);
397
396
  if (g_bg_thread_init_done) {
398
- grpc_rb_channel_polling_thread_stop();
399
397
  grpc_rb_event_queue_thread_stop();
400
398
  // all ruby-level background threads joined at this point
401
399
  g_bg_thread_init_done = false;
@@ -449,9 +447,15 @@ void grpc_rb_fork_unsafe_begin() { g_grpc_rb_num_fork_unsafe_threads++; }
449
447
  void grpc_rb_fork_unsafe_end() { g_grpc_rb_num_fork_unsafe_threads--; }
450
448
 
451
449
  // APIs to mark fork-unsafe sections from ruby code
452
- static VALUE grpc_rb_fork_unsafe_begin_api() { grpc_rb_fork_unsafe_begin(); }
450
+ static VALUE grpc_rb_fork_unsafe_begin_api() {
451
+ grpc_rb_fork_unsafe_begin();
452
+ return Qnil;
453
+ }
453
454
 
454
- static VALUE grpc_rb_fork_unsafe_end_api() { grpc_rb_fork_unsafe_end(); }
455
+ static VALUE grpc_rb_fork_unsafe_end_api() {
456
+ grpc_rb_fork_unsafe_end();
457
+ return Qnil;
458
+ }
455
459
 
456
460
  // One-time initialization
457
461
  void Init_grpc_c() {
@@ -132,7 +132,7 @@ extern grpc_metadata_credentials_create_from_plugin_type grpc_metadata_credentia
132
132
  typedef void(*grpc_call_credentials_release_type)(grpc_call_credentials* creds);
133
133
  extern grpc_call_credentials_release_type grpc_call_credentials_release_import;
134
134
  #define grpc_call_credentials_release grpc_call_credentials_release_import
135
- typedef grpc_channel_credentials*(*grpc_google_default_credentials_create_type)(grpc_call_credentials* call_credentials);
135
+ typedef grpc_channel_credentials*(*grpc_google_default_credentials_create_type)(grpc_call_credentials* call_creds_for_tls, grpc_call_credentials* call_creds_for_alts);
136
136
  extern grpc_google_default_credentials_create_type grpc_google_default_credentials_create_import;
137
137
  #define grpc_google_default_credentials_create grpc_google_default_credentials_create_import
138
138
  typedef grpc_ssl_server_certificate_config*(*grpc_ssl_server_certificate_config_create_type)(const char* pem_root_certs, const grpc_ssl_pem_key_cert_pair* pem_key_cert_pairs, size_t num_key_cert_pairs);
@@ -23,11 +23,7 @@
23
23
 
24
24
  int grpc_rb_load_core() {
25
25
  #if GPR_ARCH_64
26
- #if GRPC_RUBY_WINDOWS_UCRT
27
26
  TCHAR fname[] = _T("grpc_c.64-ucrt.ruby");
28
- #else
29
- TCHAR fname[] = _T("grpc_c.64-msvcrt.ruby");
30
- #endif
31
27
  #else
32
28
  TCHAR fname[] = _T("grpc_c.32-msvcrt.ruby");
33
29
  #endif
@@ -49,28 +49,32 @@ typedef struct grpc_rb_server {
49
49
  /* The actual server */
50
50
  grpc_server* wrapped;
51
51
  grpc_completion_queue* queue;
52
+ int shutdown_and_notify_done;
52
53
  int destroy_done;
53
54
  } grpc_rb_server;
54
55
 
55
- static void grpc_rb_server_shutdown_and_notify_internal(grpc_rb_server* server,
56
- gpr_timespec deadline) {
56
+ static void grpc_rb_server_maybe_shutdown_and_notify(grpc_rb_server* server,
57
+ gpr_timespec deadline) {
57
58
  grpc_event ev;
58
59
  void* tag = &ev;
59
- if (server->wrapped != NULL) {
60
- grpc_server_shutdown_and_notify(server->wrapped, server->queue, tag);
61
- // Following pluck calls will release the GIL and block but cannot
62
- // be interrupted. They should terminate quickly enough though b/c
63
- // we will cancel all server calls after the deadline.
64
- ev = rb_completion_queue_pluck(server->queue, tag, deadline, NULL, NULL);
65
- if (ev.type == GRPC_QUEUE_TIMEOUT) {
66
- grpc_server_cancel_all_calls(server->wrapped);
60
+ if (!server->shutdown_and_notify_done) {
61
+ server->shutdown_and_notify_done = 1;
62
+ if (server->wrapped != NULL) {
63
+ grpc_server_shutdown_and_notify(server->wrapped, server->queue, tag);
67
64
  ev = rb_completion_queue_pluck(
68
- server->queue, tag, gpr_inf_future(GPR_CLOCK_REALTIME), NULL, NULL);
69
- }
70
- if (ev.type != GRPC_OP_COMPLETE) {
71
- grpc_absl_log_int(
72
- GPR_DEBUG,
73
- "GRPC_RUBY: bad grpc_server_shutdown_and_notify result:", ev.type);
65
+ server->queue, tag, deadline,
66
+ "grpc_server_shutdown_and_notify first try");
67
+ if (ev.type == GRPC_QUEUE_TIMEOUT) {
68
+ grpc_server_cancel_all_calls(server->wrapped);
69
+ ev = rb_completion_queue_pluck(
70
+ server->queue, tag, gpr_inf_future(GPR_CLOCK_REALTIME),
71
+ "grpc_server_shutdown_and_notify second try");
72
+ }
73
+ if (ev.type != GRPC_OP_COMPLETE) {
74
+ grpc_absl_log_int(
75
+ GPR_DEBUG,
76
+ "GRPC_RUBY: bad grpc_server_shutdown_and_notify result: ", ev.type);
77
+ }
74
78
  }
75
79
  }
76
80
  }
@@ -89,19 +93,15 @@ static void grpc_rb_server_maybe_destroy(grpc_rb_server* server) {
89
93
  }
90
94
 
91
95
  static void grpc_rb_server_free_internal(void* p) {
92
- grpc_rb_server* svr = NULL;
93
- gpr_timespec deadline;
94
96
  if (p == NULL) {
95
97
  return;
96
98
  };
97
- svr = (grpc_rb_server*)p;
98
-
99
- deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
100
- gpr_time_from_seconds(2, GPR_TIMESPAN));
101
-
102
- grpc_rb_server_shutdown_and_notify_internal(svr, deadline);
103
- grpc_rb_server_maybe_destroy(svr);
104
-
99
+ grpc_rb_server* server = (grpc_rb_server*)p;
100
+ // Shutdown the server first if we haven't already
101
+ gpr_timespec deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
102
+ gpr_time_from_seconds(2, GPR_TIMESPAN));
103
+ grpc_rb_server_maybe_shutdown_and_notify(server, deadline);
104
+ grpc_rb_server_maybe_destroy(server);
105
105
  xfree(p);
106
106
  }
107
107
 
@@ -131,6 +131,7 @@ static VALUE grpc_rb_server_alloc(VALUE cls) {
131
131
  grpc_rb_server* wrapper = ALLOC(grpc_rb_server);
132
132
  wrapper->wrapped = NULL;
133
133
  wrapper->destroy_done = 0;
134
+ wrapper->shutdown_and_notify_done = 0;
134
135
  return TypedData_Wrap_Struct(cls, &grpc_rb_server_data_type, wrapper);
135
136
  }
136
137
 
@@ -190,26 +191,6 @@ struct server_request_call_args {
190
191
  request_call_stack st;
191
192
  };
192
193
 
193
- static void shutdown_server_unblock_func(void* arg) {
194
- grpc_rb_server* server = (grpc_rb_server*)arg;
195
- grpc_absl_log(GPR_DEBUG, "GRPC_RUBY: shutdown_server_unblock_func");
196
- GRPC_RUBY_ASSERT(server->wrapped != NULL);
197
- grpc_event event;
198
- void* tag = &event;
199
- grpc_server_shutdown_and_notify(server->wrapped, server->queue, tag);
200
- grpc_server_cancel_all_calls(server->wrapped);
201
- // Following call is blocking, but should finish quickly since we've
202
- // cancelled all calls.
203
- event = grpc_completion_queue_pluck(server->queue, tag,
204
- gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
205
- grpc_absl_log_int(
206
- GPR_DEBUG,
207
- "GRPC_RUBY: shutdown_server_unblock_func pluck event.type: ", event.type);
208
- grpc_absl_log_int(
209
- GPR_DEBUG,
210
- "GRPC_RUBY: shutdown_server_unblock_func event.success: ", event.success);
211
- }
212
-
213
194
  static VALUE grpc_rb_server_request_call_try(VALUE value_args) {
214
195
  grpc_rb_fork_unsafe_begin();
215
196
  struct server_request_call_args* args =
@@ -232,9 +213,9 @@ static VALUE grpc_rb_server_request_call_try(VALUE value_args) {
232
213
  grpc_call_error_detail_of(err), err);
233
214
  }
234
215
 
235
- grpc_event ev = rb_completion_queue_pluck(
236
- args->server->queue, tag, gpr_inf_future(GPR_CLOCK_REALTIME),
237
- shutdown_server_unblock_func, args->server);
216
+ grpc_event ev = rb_completion_queue_pluck(args->server->queue, tag,
217
+ gpr_inf_future(GPR_CLOCK_REALTIME),
218
+ "server request call");
238
219
  if (!ev.success) {
239
220
  rb_raise(grpc_rb_eCallError, "request_call completion failed");
240
221
  }
@@ -307,7 +288,7 @@ static VALUE grpc_rb_server_shutdown_and_notify(VALUE self, VALUE timeout) {
307
288
  deadline = grpc_rb_time_timeval(timeout, /* absolute time*/ 0);
308
289
  }
309
290
 
310
- grpc_rb_server_shutdown_and_notify_internal(s, deadline);
291
+ grpc_rb_server_maybe_shutdown_and_notify(s, deadline);
311
292
 
312
293
  return Qnil;
313
294
  }
Binary file
Binary file
Binary file
Binary file
@@ -60,7 +60,7 @@ module GRPC
60
60
  # Minimally, a stub is created with the just the host of the gRPC service
61
61
  # it wishes to access, e.g.,
62
62
  #
63
- # my_stub = ClientStub.new(example.host.com:50505,
63
+ # my_stub = ClientStub.new("example.host.com:50505",
64
64
  # :this_channel_is_insecure)
65
65
  #
66
66
  # If a channel_override argument is passed, it will be used as the
@@ -72,7 +72,7 @@ module GRPC
72
72
  #
73
73
  # - :channel_override
74
74
  # when present, this must be a pre-created GRPC::Core::Channel. If it's
75
- # present the host and arbitrary keyword arg areignored, and the RPC
75
+ # present the host and arbitrary keyword args are ignored, and the RPC
76
76
  # connection uses this channel.
77
77
  #
78
78
  # - :timeout
@@ -118,11 +118,11 @@ module GRPC
118
118
  #
119
119
  # * it does not return until a response is received.
120
120
  #
121
- # * the requests is sent only when GRPC core's flow control allows it to
121
+ # * the request is sent only when GRPC core's flow control allows it to
122
122
  # be sent.
123
123
  #
124
124
  # == Errors ==
125
- # An RuntimeError is raised if
125
+ # A RuntimeError is raised if
126
126
  #
127
127
  # * the server responds with a non-OK status
128
128
  #
@@ -14,5 +14,5 @@
14
14
 
15
15
  # GRPC contains the General RPC module.
16
16
  module GRPC
17
- VERSION = '1.72.0'
17
+ VERSION = '1.74.0.pre2'
18
18
  end
@@ -0,0 +1,22 @@
1
+ # Copyright 2015 gRPC authors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'spec_helper'
16
+
17
+ describe GRPC::Core do
18
+ it 'returns valid VALUEs from C functions' do
19
+ expect(GRPC::Core.fork_unsafe_begin).to be_nil
20
+ expect(GRPC::Core.fork_unsafe_end).to be_nil
21
+ end
22
+ end
@@ -60,8 +60,8 @@ describe GRPC::ActiveCall do
60
60
 
61
61
  after(:each) do
62
62
  @server.shutdown_and_notify(deadline)
63
- @server.close
64
63
  @server_thread.join
64
+ @server.close
65
65
  # Don't rely on GC to unref the call, since that can prevent
66
66
  # the channel connectivity state polling thread from shutting down.
67
67
  @call.close
@@ -64,12 +64,8 @@ end
64
64
  def sanity_check_values_of_accessors(op_view,
65
65
  expected_metadata,
66
66
  expected_trailing_metadata)
67
- expected_status = Struct::Status.new
68
- expected_status.code = 0
69
- expected_status.details = 'OK'
70
- expected_status.metadata = expected_trailing_metadata
71
-
72
- expect(op_view.status).to eq(expected_status)
67
+ expect(op_view.status.code).to eq(0)
68
+ expect(op_view.status.metadata).to eq(expected_trailing_metadata)
73
69
  expect(op_view.metadata).to eq(expected_metadata)
74
70
  expect(op_view.trailing_metadata).to eq(expected_trailing_metadata)
75
71
 
@@ -46,7 +46,7 @@ class FailingService
46
46
 
47
47
  def initialize(_default_var = 'ignored')
48
48
  @details = 'app error'
49
- @code = 101
49
+ @code = 3
50
50
  @md = { 'failed_method' => 'an_rpc' }
51
51
  end
52
52
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.72.0
4
+ version: 1.74.0.pre2
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - gRPC Authors
@@ -205,7 +205,6 @@ extra_rdoc_files: []
205
205
  files:
206
206
  - etc/roots.pem
207
207
  - grpc_c.32-msvcrt.ruby
208
- - grpc_c.64-msvcrt.ruby
209
208
  - grpc_c.64-ucrt.ruby
210
209
  - src/ruby/bin/math_client.rb
211
210
  - src/ruby/bin/math_pb.rb
@@ -254,7 +253,6 @@ files:
254
253
  - src/ruby/ext/grpc/rb_xds_server_credentials.c
255
254
  - src/ruby/ext/grpc/rb_xds_server_credentials.h
256
255
  - src/ruby/lib/grpc.rb
257
- - src/ruby/lib/grpc/3.0/grpc_c.so
258
256
  - src/ruby/lib/grpc/3.1/grpc_c.so
259
257
  - src/ruby/lib/grpc/3.2/grpc_c.so
260
258
  - src/ruby/lib/grpc/3.3/grpc_c.so
@@ -299,6 +297,7 @@ files:
299
297
  - src/ruby/spec/client_auth_spec.rb
300
298
  - src/ruby/spec/client_server_spec.rb
301
299
  - src/ruby/spec/compression_options_spec.rb
300
+ - src/ruby/spec/core_spec.rb
302
301
  - src/ruby/spec/debug_message_spec.rb
303
302
  - src/ruby/spec/error_sanity_spec.rb
304
303
  - src/ruby/spec/errors_spec.rb
@@ -348,7 +347,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
348
347
  requirements:
349
348
  - - ">="
350
349
  - !ruby/object:Gem::Version
351
- version: '3.0'
350
+ version: '3.1'
352
351
  - - "<"
353
352
  - !ruby/object:Gem::Version
354
353
  version: 3.5.dev
@@ -358,7 +357,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
358
357
  - !ruby/object:Gem::Version
359
358
  version: '0'
360
359
  requirements: []
361
- rubygems_version: 3.6.8
360
+ rubygems_version: 3.7.0
362
361
  specification_version: 4
363
362
  summary: GRPC system in Ruby
364
363
  test_files:
@@ -373,6 +372,7 @@ test_files:
373
372
  - src/ruby/spec/client_auth_spec.rb
374
373
  - src/ruby/spec/client_server_spec.rb
375
374
  - src/ruby/spec/compression_options_spec.rb
375
+ - src/ruby/spec/core_spec.rb
376
376
  - src/ruby/spec/debug_message_spec.rb
377
377
  - src/ruby/spec/error_sanity_spec.rb
378
378
  - src/ruby/spec/errors_spec.rb
File without changes
Binary file