grpc 1.64.0-x64-mingw-ucrt → 1.65.0.pre1-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64e10686482a02a792fa476ab874b55278e270e0dca5cbba7a2e1a6a248b063c
4
- data.tar.gz: f30280166a3e69bab8636782735ba8565b5f77ba567c8af9399953060b8643fe
3
+ metadata.gz: 585ddb9c384cc4dc37c54517d06eb45f08f63cd29d7d0ff3728c8be94e6eba5d
4
+ data.tar.gz: d40565406749781c5f862332f26ceed0375674796ecc5f9c2d332655a16d8526
5
5
  SHA512:
6
- metadata.gz: c480415b7b232e3f5e1e7728ced25663c3bb9847310d23ae9af0260d7f6b9f599c9192d56d6e6e912a163dcddb42ca2c8607c5c13d994b1db478560714eac44c
7
- data.tar.gz: 61cd5631a8e4beb2edde12a3a1b682aa46b370ed98508367db909fa115dcab7a552c26f60edb97fa97d8a815f7d33084e8656c6e74965f9a0b9d1da4757e7f0b
6
+ metadata.gz: ab3d25867689d2ddca0ae0b07a41b861cd880bbeb04196913c5e574c55522c09e82618d6758965d569df3fab19dfafab32d599aee013c78b606792787534b994
7
+ data.tar.gz: 3f849791255cc9734d2070fb593a6b452c462f05fe2a195c715639cacdfb87399f7786ccbd99bf196b701f122c116794d1e21eec5f86ed51db1af595a3abe1ec
data/grpc_c.64-ucrt.ruby CHANGED
Binary file
@@ -808,6 +808,12 @@ struct call_run_batch_args {
808
808
  run_batch_stack* st;
809
809
  };
810
810
 
811
+ static void cancel_call_unblock_func(void* arg) {
812
+ gpr_log(GPR_INFO, "GRPC_RUBY: cancel_call_unblock_func");
813
+ grpc_call* call = (grpc_call*)arg;
814
+ grpc_call_cancel(call, NULL);
815
+ }
816
+
811
817
  static VALUE grpc_rb_call_run_batch_try(VALUE value_args) {
812
818
  grpc_rb_fork_unsafe_begin();
813
819
  struct call_run_batch_args* args = (struct call_run_batch_args*)value_args;
@@ -830,7 +836,8 @@ static VALUE grpc_rb_call_run_batch_try(VALUE value_args) {
830
836
  grpc_call_error_detail_of(err), err);
831
837
  }
832
838
  ev = rb_completion_queue_pluck(args->call->queue, tag,
833
- gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
839
+ gpr_inf_future(GPR_CLOCK_REALTIME),
840
+ cancel_call_unblock_func, args->call->wrapped);
834
841
  if (!ev.success) {
835
842
  rb_raise(grpc_rb_eCallError, "call#run_batch failed somehow");
836
843
  }
@@ -35,23 +35,15 @@ typedef struct next_call_stack {
35
35
  grpc_event event;
36
36
  gpr_timespec timeout;
37
37
  void* tag;
38
- volatile int interrupted;
38
+ void (*unblock_func)(void*);
39
+ void* unblock_func_arg;
39
40
  } next_call_stack;
40
41
 
41
42
  /* Calls grpc_completion_queue_pluck without holding the ruby GIL */
42
43
  static void* grpc_rb_completion_queue_pluck_no_gil(void* param) {
43
44
  next_call_stack* const next_call = (next_call_stack*)param;
44
- gpr_timespec increment = gpr_time_from_millis(20, GPR_TIMESPAN);
45
- gpr_timespec deadline;
46
- do {
47
- deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), increment);
48
- next_call->event = grpc_completion_queue_pluck(
49
- next_call->cq, next_call->tag, deadline, NULL);
50
- if (next_call->event.type != GRPC_QUEUE_TIMEOUT ||
51
- gpr_time_cmp(deadline, next_call->timeout) > 0) {
52
- break;
53
- }
54
- } while (!next_call->interrupted);
45
+ next_call->event = grpc_completion_queue_pluck(next_call->cq, next_call->tag,
46
+ next_call->timeout, NULL);
55
47
  return NULL;
56
48
  }
57
49
 
@@ -65,37 +57,28 @@ void grpc_rb_completion_queue_destroy(grpc_completion_queue* cq) {
65
57
  grpc_completion_queue_destroy(cq);
66
58
  }
67
59
 
68
- static void unblock_func(void* param) {
60
+ static void outer_unblock_func(void* param) {
69
61
  next_call_stack* const next_call = (next_call_stack*)param;
70
- next_call->interrupted = 1;
62
+ if (next_call->unblock_func == NULL) return;
63
+ next_call->unblock_func(next_call->unblock_func_arg);
71
64
  }
72
65
 
73
66
  /* Does the same thing as grpc_completion_queue_pluck, while properly releasing
74
67
  the GVL and handling interrupts */
75
68
  grpc_event rb_completion_queue_pluck(grpc_completion_queue* queue, void* tag,
76
- gpr_timespec deadline, void* reserved) {
69
+ gpr_timespec deadline,
70
+ void (*unblock_func)(void* param),
71
+ void* unblock_func_arg) {
77
72
  next_call_stack next_call;
78
73
  MEMZERO(&next_call, next_call_stack, 1);
79
74
  next_call.cq = queue;
80
75
  next_call.timeout = deadline;
81
76
  next_call.tag = tag;
82
77
  next_call.event.type = GRPC_QUEUE_TIMEOUT;
83
- (void)reserved;
84
- /* Loop until we finish a pluck without an interruption. The internal
85
- pluck function runs either until it is interrupted or it gets an
86
- event, or time runs out.
87
-
88
- The basic reason we need this relatively complicated construction is that
89
- we need to re-acquire the GVL when an interrupt comes in, so that the ruby
90
- interpreter can do what it needs to do with the interrupt. But we also need
91
- to get back to plucking when the interrupt has been handled. */
92
- do {
93
- next_call.interrupted = 0;
94
- rb_thread_call_without_gvl(grpc_rb_completion_queue_pluck_no_gil,
95
- (void*)&next_call, unblock_func,
96
- (void*)&next_call);
97
- /* If an interrupt prevented pluck from returning useful information, then
98
- any plucks that did complete must have timed out */
99
- } while (next_call.interrupted && next_call.event.type == GRPC_QUEUE_TIMEOUT);
78
+ next_call.unblock_func = unblock_func;
79
+ next_call.unblock_func_arg = unblock_func_arg;
80
+ rb_thread_call_without_gvl(grpc_rb_completion_queue_pluck_no_gil,
81
+ (void*)&next_call, outer_unblock_func,
82
+ (void*)&next_call);
100
83
  return next_call.event;
101
84
  }
@@ -29,8 +29,14 @@ 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.
32
36
  */
33
37
  grpc_event rb_completion_queue_pluck(grpc_completion_queue* queue, void* tag,
34
- gpr_timespec deadline, void* reserved);
38
+ gpr_timespec deadline,
39
+ void (*unblock_func)(void* param),
40
+ void* unblock_func_arg);
35
41
 
36
42
  #endif /* GRPC_RB_COMPLETION_QUEUE_H_ */
@@ -49,29 +49,28 @@ 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;
53
52
  int destroy_done;
54
53
  } grpc_rb_server;
55
54
 
56
- static void grpc_rb_server_maybe_shutdown_and_notify(grpc_rb_server* server,
57
- gpr_timespec deadline) {
55
+ static void grpc_rb_server_shutdown_and_notify_internal(grpc_rb_server* server,
56
+ gpr_timespec deadline) {
58
57
  grpc_event ev;
59
58
  void* tag = &ev;
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);
64
- ev = rb_completion_queue_pluck(server->queue, tag, deadline, NULL);
65
- if (ev.type == GRPC_QUEUE_TIMEOUT) {
66
- grpc_server_cancel_all_calls(server->wrapped);
67
- ev = rb_completion_queue_pluck(
68
- server->queue, tag, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
69
- }
70
- if (ev.type != GRPC_OP_COMPLETE) {
71
- gpr_log(GPR_INFO,
72
- "GRPC_RUBY: bad grpc_server_shutdown_and_notify result:%d",
73
- ev.type);
74
- }
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);
67
+ 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
+ gpr_log(GPR_INFO,
72
+ "GRPC_RUBY: bad grpc_server_shutdown_and_notify result:%d",
73
+ ev.type);
75
74
  }
76
75
  }
77
76
  }
@@ -100,7 +99,7 @@ static void grpc_rb_server_free_internal(void* p) {
100
99
  deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
101
100
  gpr_time_from_seconds(2, GPR_TIMESPAN));
102
101
 
103
- grpc_rb_server_maybe_shutdown_and_notify(svr, deadline);
102
+ grpc_rb_server_shutdown_and_notify_internal(svr, deadline);
104
103
  grpc_rb_server_maybe_destroy(svr);
105
104
 
106
105
  xfree(p);
@@ -132,7 +131,6 @@ static VALUE grpc_rb_server_alloc(VALUE cls) {
132
131
  grpc_rb_server* wrapper = ALLOC(grpc_rb_server);
133
132
  wrapper->wrapped = NULL;
134
133
  wrapper->destroy_done = 0;
135
- wrapper->shutdown_and_notify_done = 0;
136
134
  return TypedData_Wrap_Struct(cls, &grpc_rb_server_data_type, wrapper);
137
135
  }
138
136
 
@@ -192,6 +190,24 @@ struct server_request_call_args {
192
190
  request_call_stack st;
193
191
  };
194
192
 
193
+ static void shutdown_server_unblock_func(void* arg) {
194
+ grpc_rb_server* server = (grpc_rb_server*)arg;
195
+ gpr_log(GPR_INFO, "GRPC_RUBY: shutdown_server_unblock_func");
196
+ GPR_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
+ gpr_log(GPR_INFO,
206
+ "GRPC_RUBY: shutdown_server_unblock_func pluck event.type: %d "
207
+ "event.success: %d",
208
+ event.type, event.success);
209
+ }
210
+
195
211
  static VALUE grpc_rb_server_request_call_try(VALUE value_args) {
196
212
  grpc_rb_fork_unsafe_begin();
197
213
  struct server_request_call_args* args =
@@ -215,7 +231,8 @@ static VALUE grpc_rb_server_request_call_try(VALUE value_args) {
215
231
  }
216
232
 
217
233
  grpc_event ev = rb_completion_queue_pluck(
218
- args->server->queue, tag, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
234
+ args->server->queue, tag, gpr_inf_future(GPR_CLOCK_REALTIME),
235
+ shutdown_server_unblock_func, args->server);
219
236
  if (!ev.success) {
220
237
  rb_raise(grpc_rb_eCallError, "request_call completion failed");
221
238
  }
@@ -288,7 +305,7 @@ static VALUE grpc_rb_server_shutdown_and_notify(VALUE self, VALUE timeout) {
288
305
  deadline = grpc_rb_time_timeval(timeout, /* absolute time*/ 0);
289
306
  }
290
307
 
291
- grpc_rb_server_maybe_shutdown_and_notify(s, deadline);
308
+ grpc_rb_server_shutdown_and_notify_internal(s, deadline);
292
309
 
293
310
  return Qnil;
294
311
  }
Binary file
Binary file
Binary file
@@ -14,5 +14,5 @@
14
14
 
15
15
  # GRPC contains the General RPC module.
16
16
  module GRPC
17
- VERSION = '1.64.0'
17
+ VERSION = '1.65.0.pre1'
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.64.0
4
+ version: 1.65.0.pre1
5
5
  platform: x64-mingw-ucrt
6
6
  authors:
7
7
  - gRPC Authors
8
8
  autorequire:
9
9
  bindir: src/ruby/bin
10
10
  cert_chain: []
11
- date: 2024-05-16 00:00:00.000000000 Z
11
+ date: 2024-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -351,7 +351,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
351
351
  - !ruby/object:Gem::Version
352
352
  version: '0'
353
353
  requirements: []
354
- rubygems_version: 3.5.10
354
+ rubygems_version: 3.5.12
355
355
  signing_key:
356
356
  specification_version: 4
357
357
  summary: GRPC system in Ruby