grpc 1.64.0.pre1-x86-mingw32 → 1.65.0.pre1-x86-mingw32

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: b8fb9a5ecb67a0cb950aaa0acb1a2ecf9c73fe3087b132534fba0a21665df884
4
- data.tar.gz: 4571baf466e1d1d4489606b17f2037858bd5399328dca01251afb75a1fadfe5c
3
+ metadata.gz: 59753bee6ce06868e2b7e53b81c48bae14a3d117317fd510e69d1e1cf51f3a29
4
+ data.tar.gz: 51cdef0499763dd0590e852b0c947b1051aef9f6c011e03083757eb06c1fa0f2
5
5
  SHA512:
6
- metadata.gz: 1982db85983b9ccfa2874a5a3f98fdf11ca02d7dcc80908b89f134a030b9554b21269c9978e9ca998ed3316304896769ba5c4ab5bc7fa676c69c10809e01edda
7
- data.tar.gz: 81043738611e89ee623fc71ce1b323eddc32d3ec2431f970580bd7e20174af0371784920c3ebeb4b57c95994bb2ae1949b8ff703aba749bdb603dbbec732b806
6
+ metadata.gz: ca1d1f78ca2b630d1176328419086e81473eebb2033f0218c408d2cd655a56369adeea28206261a39a344d6630c8a5a294f1763970f3334f97767c302f56ebbe
7
+ data.tar.gz: a9a27e73a0e3df886b38fb46baffc585e2be27af2f8f3f5732131e038794aa12ee45f8ef9d5fa147ad99b2473c34f044c246ce3bc6c9c7e91029ec2da95e20ec
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
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.pre1'
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.pre1
4
+ version: 1.65.0.pre1
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - gRPC Authors
8
8
  autorequire:
9
9
  bindir: src/ruby/bin
10
10
  cert_chain: []
11
- date: 2024-05-07 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
@@ -353,7 +353,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
353
353
  - !ruby/object:Gem::Version
354
354
  version: '0'
355
355
  requirements: []
356
- rubygems_version: 3.5.10
356
+ rubygems_version: 3.5.12
357
357
  signing_key:
358
358
  specification_version: 4
359
359
  summary: GRPC system in Ruby