grpc 1.64.0-x86-linux → 1.65.0.pre1-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/src/ruby/ext/grpc/rb_call.c +8 -1
- data/src/ruby/ext/grpc/rb_completion_queue.c +15 -32
- data/src/ruby/ext/grpc/rb_completion_queue.h +7 -1
- data/src/ruby/ext/grpc/rb_server.c +39 -22
- data/src/ruby/lib/grpc/2.7/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.0/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.1/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.2/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.3/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6486a526b019c35f10465aa6e52213dd474b5cf1d6a93a2a6e615c348aa3ec3
|
4
|
+
data.tar.gz: 662ddb8db34b528c3cdc4a3296af57a09b45c727977f83db435a554d93d8b6e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccb986e1ca9505420bcee99e7a8ebf139eb0ac5907a7e8d10550ce6a3444230634c4bf36380cebc210a49cc07a0d640f7b83a33f073a89cc4ee6160ef0a35d42
|
7
|
+
data.tar.gz: b830815ca3f3daf6252e1473f448e8826e8f0bed29f3e8b61f4514c46a841ee2b05c307850ada75f255b02b1edbf939b52f32b7039f3931c6dc6a88eec381ca4
|
data/src/ruby/ext/grpc/rb_call.c
CHANGED
@@ -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),
|
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
|
-
|
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
|
-
|
45
|
-
|
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
|
60
|
+
static void outer_unblock_func(void* param) {
|
69
61
|
next_call_stack* const next_call = (next_call_stack*)param;
|
70
|
-
next_call->
|
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,
|
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
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
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,
|
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
|
57
|
-
|
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 (
|
61
|
-
server->
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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
|
-
|
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),
|
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
|
-
|
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
|
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.
|
4
|
+
version: 1.65.0.pre1
|
5
5
|
platform: x86-linux
|
6
6
|
authors:
|
7
7
|
- gRPC Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: src/ruby/bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
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.
|
356
|
+
rubygems_version: 3.5.12
|
357
357
|
signing_key:
|
358
358
|
specification_version: 4
|
359
359
|
summary: GRPC system in Ruby
|