grpc 1.10.0-x86-linux → 1.11.0.pre2-x86-linux

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38a103188ebe6268798e5cce632667b922970e6454db94d1bbf8ae642cd28740
4
- data.tar.gz: 11fe05f7b6db6abdb0f8e96345bf46cfc6302986ff179cdf819d2a6fc375c933
3
+ metadata.gz: ddbf323cdc6cabab9e438ede98b2c1572ecefb1302c05cb5f62d78b69788c0c7
4
+ data.tar.gz: 4bcd2a218c81a17f78a6d40b219c3e0ec5a597a6e06a34a7fbb48e6c5238896b
5
5
  SHA512:
6
- metadata.gz: 5e9a72f1f558ca2d360c63f50418b95631c0c142f567044cf2bbb1bcf04bb8e5fbd2dfb42f27dd69500bbb6e391a0cc85da7b03d15e4df6dcbef19411f73f2c2
7
- data.tar.gz: 6a59ed9ed2f519406f4579fb9e4bf8147e68158904de90a0018c68ce9f1ef36c936b2e1a88eb27d26b84632f397ab27f8feaaadcea307dfaed554f598e0cb0c2
6
+ metadata.gz: 987f97b852ba4fb915a234b07554fae2104cc39c11ada1f54516e5d2059ad34cccaed693096f859bd3f01d7ba4e73a766af633777809f6c1f354f5dafaca0f3f
7
+ data.tar.gz: fb614b230213d63ba69f52cf38379a8616e91c1b3a94eef63b6d669754e05596ebe3ee07960cf7244286633c2a99a51d966ebfcae7dde196bf037674888578c3
Binary file
Binary file
@@ -84,7 +84,7 @@ if grpc_config == 'gcov'
84
84
  end
85
85
 
86
86
  if grpc_config == 'dbg'
87
- $CFLAGS << ' -O0'
87
+ $CFLAGS << ' -O0 -ggdb3'
88
88
  end
89
89
 
90
90
  $LDFLAGS << ' -Wl,-wrap,memcpy' if RUBY_PLATFORM =~ /linux/
@@ -94,7 +94,6 @@ $CFLAGS << ' -std=c99 '
94
94
  $CFLAGS << ' -Wall '
95
95
  $CFLAGS << ' -Wextra '
96
96
  $CFLAGS << ' -pedantic '
97
- $CFLAGS << ' -Wno-format '
98
97
 
99
98
  output = File.join('grpc', 'grpc_c')
100
99
  puts 'Generating Makefile for ' + output
@@ -103,23 +103,11 @@ static void grpc_rb_call_destroy(void* p) {
103
103
  xfree(p);
104
104
  }
105
105
 
106
- static size_t md_ary_datasize(const void* p) {
107
- const grpc_metadata_array* const ary = (grpc_metadata_array*)p;
108
- size_t i, datasize = sizeof(grpc_metadata_array);
109
- for (i = 0; i < ary->count; ++i) {
110
- const grpc_metadata* const md = &ary->metadata[i];
111
- datasize += GRPC_SLICE_LENGTH(md->key);
112
- datasize += GRPC_SLICE_LENGTH(md->value);
113
- }
114
- datasize += ary->capacity * sizeof(grpc_metadata);
115
- return datasize;
116
- }
117
-
118
106
  static const rb_data_type_t grpc_rb_md_ary_data_type = {
119
107
  "grpc_metadata_array",
120
108
  {GRPC_RB_GC_NOT_MARKED,
121
109
  GRPC_RB_GC_DONT_FREE,
122
- md_ary_datasize,
110
+ GRPC_RB_MEMSIZE_UNAVAILABLE,
123
111
  {NULL, NULL}},
124
112
  NULL,
125
113
  NULL,
@@ -315,7 +315,7 @@ static VALUE grpc_rb_channel_get_connectivity_state(int argc, VALUE* argv,
315
315
  }
316
316
 
317
317
  typedef struct watch_state_stack {
318
- grpc_channel* channel;
318
+ bg_watched_channel* bg_wrapped;
319
319
  gpr_timespec deadline;
320
320
  int last_state;
321
321
  } watch_state_stack;
@@ -328,15 +328,15 @@ static void* wait_for_watch_state_op_complete_without_gvl(void* arg) {
328
328
  gpr_mu_lock(&global_connection_polling_mu);
329
329
  // its unsafe to do a "watch" after "channel polling abort" because the cq has
330
330
  // been shut down.
331
- if (abort_channel_polling) {
331
+ if (abort_channel_polling || stack->bg_wrapped->channel_destroyed) {
332
332
  gpr_mu_unlock(&global_connection_polling_mu);
333
333
  return (void*)0;
334
334
  }
335
335
  op = gpr_zalloc(sizeof(watch_state_op));
336
336
  op->op_type = WATCH_STATE_API;
337
- grpc_channel_watch_connectivity_state(stack->channel, stack->last_state,
338
- stack->deadline, channel_polling_cq,
339
- op);
337
+ grpc_channel_watch_connectivity_state(stack->bg_wrapped->channel,
338
+ stack->last_state, stack->deadline,
339
+ channel_polling_cq, op);
340
340
 
341
341
  while (!op->op.api_callback_args.called_back) {
342
342
  gpr_cv_wait(&global_connection_polling_cv, &global_connection_polling_mu,
@@ -388,7 +388,7 @@ static VALUE grpc_rb_channel_watch_connectivity_state(VALUE self,
388
388
  return Qnil;
389
389
  }
390
390
 
391
- stack.channel = wrapper->bg_wrapped->channel;
391
+ stack.bg_wrapped = wrapper->bg_wrapped;
392
392
  stack.deadline = grpc_rb_time_timeval(deadline, 0),
393
393
  stack.last_state = NUM2LONG(last_state);
394
394
 
@@ -186,7 +186,7 @@ void grpc_rb_compression_options_algorithm_name_to_value_internal(
186
186
  error_message_ruby_str =
187
187
  rb_str_new(error_message_str, strlen(error_message_str));
188
188
  gpr_free(error_message_str);
189
- rb_raise(rb_eNameError, StringValueCStr(error_message_ruby_str));
189
+ rb_raise(rb_eNameError, "%s", StringValueCStr(error_message_ruby_str));
190
190
  }
191
191
 
192
192
  grpc_slice_unref(name_slice);
@@ -68,6 +68,8 @@ grpc_channel_get_info_type grpc_channel_get_info_import;
68
68
  grpc_insecure_channel_create_type grpc_insecure_channel_create_import;
69
69
  grpc_lame_client_channel_create_type grpc_lame_client_channel_create_import;
70
70
  grpc_channel_destroy_type grpc_channel_destroy_import;
71
+ grpc_channel_get_trace_type grpc_channel_get_trace_import;
72
+ grpc_channel_get_uuid_type grpc_channel_get_uuid_import;
71
73
  grpc_call_cancel_type grpc_call_cancel_import;
72
74
  grpc_call_cancel_with_status_type grpc_call_cancel_with_status_import;
73
75
  grpc_call_ref_type grpc_call_ref_import;
@@ -106,6 +108,9 @@ grpc_auth_context_release_type grpc_auth_context_release_import;
106
108
  grpc_auth_context_add_property_type grpc_auth_context_add_property_import;
107
109
  grpc_auth_context_add_cstring_property_type grpc_auth_context_add_cstring_property_import;
108
110
  grpc_auth_context_set_peer_identity_property_name_type grpc_auth_context_set_peer_identity_property_name_import;
111
+ grpc_ssl_session_cache_create_lru_type grpc_ssl_session_cache_create_lru_import;
112
+ grpc_ssl_session_cache_destroy_type grpc_ssl_session_cache_destroy_import;
113
+ grpc_ssl_session_cache_create_channel_arg_type grpc_ssl_session_cache_create_channel_arg_import;
109
114
  grpc_channel_credentials_release_type grpc_channel_credentials_release_import;
110
115
  grpc_google_default_credentials_create_type grpc_google_default_credentials_create_import;
111
116
  grpc_set_ssl_roots_override_callback_type grpc_set_ssl_roots_override_callback_import;
@@ -304,6 +309,8 @@ void grpc_rb_load_imports(HMODULE library) {
304
309
  grpc_insecure_channel_create_import = (grpc_insecure_channel_create_type) GetProcAddress(library, "grpc_insecure_channel_create");
305
310
  grpc_lame_client_channel_create_import = (grpc_lame_client_channel_create_type) GetProcAddress(library, "grpc_lame_client_channel_create");
306
311
  grpc_channel_destroy_import = (grpc_channel_destroy_type) GetProcAddress(library, "grpc_channel_destroy");
312
+ grpc_channel_get_trace_import = (grpc_channel_get_trace_type) GetProcAddress(library, "grpc_channel_get_trace");
313
+ grpc_channel_get_uuid_import = (grpc_channel_get_uuid_type) GetProcAddress(library, "grpc_channel_get_uuid");
307
314
  grpc_call_cancel_import = (grpc_call_cancel_type) GetProcAddress(library, "grpc_call_cancel");
308
315
  grpc_call_cancel_with_status_import = (grpc_call_cancel_with_status_type) GetProcAddress(library, "grpc_call_cancel_with_status");
309
316
  grpc_call_ref_import = (grpc_call_ref_type) GetProcAddress(library, "grpc_call_ref");
@@ -342,6 +349,9 @@ void grpc_rb_load_imports(HMODULE library) {
342
349
  grpc_auth_context_add_property_import = (grpc_auth_context_add_property_type) GetProcAddress(library, "grpc_auth_context_add_property");
343
350
  grpc_auth_context_add_cstring_property_import = (grpc_auth_context_add_cstring_property_type) GetProcAddress(library, "grpc_auth_context_add_cstring_property");
344
351
  grpc_auth_context_set_peer_identity_property_name_import = (grpc_auth_context_set_peer_identity_property_name_type) GetProcAddress(library, "grpc_auth_context_set_peer_identity_property_name");
352
+ grpc_ssl_session_cache_create_lru_import = (grpc_ssl_session_cache_create_lru_type) GetProcAddress(library, "grpc_ssl_session_cache_create_lru");
353
+ grpc_ssl_session_cache_destroy_import = (grpc_ssl_session_cache_destroy_type) GetProcAddress(library, "grpc_ssl_session_cache_destroy");
354
+ grpc_ssl_session_cache_create_channel_arg_import = (grpc_ssl_session_cache_create_channel_arg_type) GetProcAddress(library, "grpc_ssl_session_cache_create_channel_arg");
345
355
  grpc_channel_credentials_release_import = (grpc_channel_credentials_release_type) GetProcAddress(library, "grpc_channel_credentials_release");
346
356
  grpc_google_default_credentials_create_import = (grpc_google_default_credentials_create_type) GetProcAddress(library, "grpc_google_default_credentials_create");
347
357
  grpc_set_ssl_roots_override_callback_import = (grpc_set_ssl_roots_override_callback_type) GetProcAddress(library, "grpc_set_ssl_roots_override_callback");
@@ -179,6 +179,12 @@ extern grpc_lame_client_channel_create_type grpc_lame_client_channel_create_impo
179
179
  typedef void(*grpc_channel_destroy_type)(grpc_channel* channel);
180
180
  extern grpc_channel_destroy_type grpc_channel_destroy_import;
181
181
  #define grpc_channel_destroy grpc_channel_destroy_import
182
+ typedef char*(*grpc_channel_get_trace_type)(grpc_channel* channel);
183
+ extern grpc_channel_get_trace_type grpc_channel_get_trace_import;
184
+ #define grpc_channel_get_trace grpc_channel_get_trace_import
185
+ typedef intptr_t(*grpc_channel_get_uuid_type)(grpc_channel* channel);
186
+ extern grpc_channel_get_uuid_type grpc_channel_get_uuid_import;
187
+ #define grpc_channel_get_uuid grpc_channel_get_uuid_import
182
188
  typedef grpc_call_error(*grpc_call_cancel_type)(grpc_call* call, void* reserved);
183
189
  extern grpc_call_cancel_type grpc_call_cancel_import;
184
190
  #define grpc_call_cancel grpc_call_cancel_import
@@ -293,6 +299,15 @@ extern grpc_auth_context_add_cstring_property_type grpc_auth_context_add_cstring
293
299
  typedef int(*grpc_auth_context_set_peer_identity_property_name_type)(grpc_auth_context* ctx, const char* name);
294
300
  extern grpc_auth_context_set_peer_identity_property_name_type grpc_auth_context_set_peer_identity_property_name_import;
295
301
  #define grpc_auth_context_set_peer_identity_property_name grpc_auth_context_set_peer_identity_property_name_import
302
+ typedef grpc_ssl_session_cache*(*grpc_ssl_session_cache_create_lru_type)(size_t capacity);
303
+ extern grpc_ssl_session_cache_create_lru_type grpc_ssl_session_cache_create_lru_import;
304
+ #define grpc_ssl_session_cache_create_lru grpc_ssl_session_cache_create_lru_import
305
+ typedef void(*grpc_ssl_session_cache_destroy_type)(grpc_ssl_session_cache* cache);
306
+ extern grpc_ssl_session_cache_destroy_type grpc_ssl_session_cache_destroy_import;
307
+ #define grpc_ssl_session_cache_destroy grpc_ssl_session_cache_destroy_import
308
+ typedef grpc_arg(*grpc_ssl_session_cache_create_channel_arg_type)(grpc_ssl_session_cache* cache);
309
+ extern grpc_ssl_session_cache_create_channel_arg_type grpc_ssl_session_cache_create_channel_arg_import;
310
+ #define grpc_ssl_session_cache_create_channel_arg grpc_ssl_session_cache_create_channel_arg_import
296
311
  typedef void(*grpc_channel_credentials_release_type)(grpc_channel_credentials* creds);
297
312
  extern grpc_channel_credentials_release_type grpc_channel_credentials_release_import;
298
313
  #define grpc_channel_credentials_release grpc_channel_credentials_release_import
@@ -32,7 +32,7 @@ module GRPC
32
32
  # * timish == 0 => TimeConsts.ZERO
33
33
  #
34
34
  # @param timeish [Number|TimeSpec]
35
- # @return timeish [Number|TimeSpec]
35
+ # @return [Number|TimeSpec]
36
36
  def from_relative_time(timeish)
37
37
  if timeish.is_a? TimeSpec
38
38
  timeish
@@ -64,7 +64,7 @@ module GRPC
64
64
  # @param requests the Enumerable of requests to send
65
65
  # @param set_input_stream_done [Proc] called back when we're done
66
66
  # reading the input stream
67
- # @param set_input_stream_done [Proc] called back when we're done
67
+ # @param set_output_stream_done [Proc] called back when we're done
68
68
  # sending data on the output stream
69
69
  # @return an Enumerator of requests to yield
70
70
  def run_on_client(requests,
@@ -124,12 +124,18 @@ module GRPC
124
124
  def read_using_run_batch
125
125
  ops = { RECV_MESSAGE => nil }
126
126
  ops[RECV_INITIAL_METADATA] = nil unless @metadata_received
127
- batch_result = @call.run_batch(ops)
128
- unless @metadata_received
129
- @call.metadata = batch_result.metadata
130
- @metadata_received = true
127
+ begin
128
+ batch_result = @call.run_batch(ops)
129
+ unless @metadata_received
130
+ @call.metadata = batch_result.metadata
131
+ @metadata_received = true
132
+ end
133
+ batch_result
134
+ rescue GRPC::Core::CallError => e
135
+ GRPC.logger.warn('bidi call: read_using_run_batch failed')
136
+ GRPC.logger.warn(e)
137
+ nil
131
138
  end
132
- batch_result
133
139
  end
134
140
 
135
141
  # set_output_stream_done is relevant on client-side
@@ -155,7 +161,12 @@ module GRPC
155
161
  GRPC.logger.debug("bidi-write-loop: #{count} writes done")
156
162
  if is_client
157
163
  GRPC.logger.debug("bidi-write-loop: client sent #{count}, waiting")
158
- @call.run_batch(SEND_CLOSE_FROM_CLIENT => nil)
164
+ begin
165
+ @call.run_batch(SEND_CLOSE_FROM_CLIENT => nil)
166
+ rescue GRPC::Core::CallError => e
167
+ GRPC.logger.warn('bidi-write-loop: send close failed')
168
+ GRPC.logger.warn(e)
169
+ end
159
170
  GRPC.logger.debug('bidi-write-loop: done')
160
171
  end
161
172
  GRPC.logger.debug('bidi-write-loop: finished')
@@ -187,7 +198,7 @@ module GRPC
187
198
  batch_result = read_using_run_batch
188
199
 
189
200
  # handle the next message
190
- if batch_result.message.nil?
201
+ if batch_result.nil? || batch_result.message.nil?
191
202
  GRPC.logger.debug("bidi-read-loop: null batch #{batch_result}")
192
203
 
193
204
  if is_client
@@ -58,8 +58,8 @@ module GRPC
58
58
  # Minimally, a stub is created with the just the host of the gRPC service
59
59
  # it wishes to access, e.g.,
60
60
  #
61
- # my_stub = ClientStub.new(example.host.com:50505,
62
- # :this_channel_is_insecure)
61
+ # my_stub = ClientStub.new(example.host.com:50505,
62
+ # :this_channel_is_insecure)
63
63
  #
64
64
  # If a channel_override argument is passed, it will be used as the
65
65
  # underlying channel. Otherwise, the channel_args argument will be used
@@ -376,7 +376,7 @@ module GRPC
376
376
  # This is a blocking call.
377
377
  #
378
378
  # * the call completes when the next call to provided block returns
379
- # * [False]
379
+ # false
380
380
  #
381
381
  # * the execution block parameters are two objects for sending and
382
382
  # receiving responses, each of which blocks waiting for flow control.
@@ -398,13 +398,9 @@ module GRPC
398
398
  # responses by throwing StopIteration, but can only happen either
399
399
  # if bidi_call#writes_done is called.
400
400
  #
401
- # To terminate the RPC correctly the block:
402
- #
403
- # * must call bidi#writes_done and then
404
- #
405
- # * either return false as soon as there is no need for other responses
406
- #
407
- # * loop on responses#next until no further responses are available
401
+ # To properly terminate the RPC, the responses should be completely iterated
402
+ # through; one way to do this is to loop on responses#next until no further
403
+ # responses are available.
408
404
  #
409
405
  # == Errors ==
410
406
  # An RuntimeError is raised if
@@ -153,7 +153,7 @@ module GRPC
153
153
  #
154
154
  class InterceptionContext
155
155
  ##
156
- # @param [Array<GRPC::Interceptor>]
156
+ # @param interceptors [Array<GRPC::Interceptor>]
157
157
  #
158
158
  def initialize(interceptors = [])
159
159
  @interceptors = interceptors.dup
@@ -204,7 +204,7 @@ module GRPC
204
204
  # * connect_md_proc:
205
205
  # when non-nil is a proc for determining metadata to to send back the client
206
206
  # on receiving an invocation req. The proc signature is:
207
- # {key: val, ..} func(method_name, {key: val, ...})
207
+ # {key: val, ..} func(method_name, {key: val, ...})
208
208
  #
209
209
  # * server_args:
210
210
  # A server arguments hash to be passed down to the underlying core server
@@ -283,7 +283,7 @@ module GRPC
283
283
  # If run has not been called, this returns immediately.
284
284
  #
285
285
  # @param timeout [Numeric] number of seconds to wait
286
- # @result [true, false] true if the server is running, false otherwise
286
+ # @return [true, false] true if the server is running, false otherwise
287
287
  def wait_till_running(timeout = nil)
288
288
  @run_mutex.synchronize do
289
289
  @run_cond.wait(@run_mutex, timeout) if @running_state == :not_started
@@ -14,5 +14,5 @@
14
14
 
15
15
  # GRPC contains the General RPC module.
16
16
  module GRPC
17
- VERSION = '1.10.0'
17
+ VERSION = '1.11.0.pre2'
18
18
  end
@@ -750,6 +750,90 @@ describe 'ClientStub' do # rubocop:disable Metrics/BlockLength
750
750
  expected_error_message)
751
751
  end
752
752
  end
753
+
754
+ # Prompted by grpc/github #14853
755
+ describe 'client-side error handling on bidi streams' do
756
+ class EnumeratorQueue
757
+ def initialize(queue)
758
+ @queue = queue
759
+ end
760
+
761
+ def each
762
+ loop do
763
+ msg = @queue.pop
764
+ break if msg.nil?
765
+ yield msg
766
+ end
767
+ end
768
+ end
769
+
770
+ def run_server_bidi_shutdown_after_one_read
771
+ @server.start
772
+ recvd_rpc = @server.request_call
773
+ recvd_call = recvd_rpc.call
774
+ server_call = GRPC::ActiveCall.new(
775
+ recvd_call, noop, noop, INFINITE_FUTURE,
776
+ metadata_received: true, started: false)
777
+ expect(server_call.remote_read).to eq('first message')
778
+ @server.shutdown_and_notify(from_relative_time(0))
779
+ @server.close
780
+ end
781
+
782
+ it 'receives a grpc status code when writes to a bidi stream fail' do
783
+ # This test tries to trigger the case when a 'SEND_MESSAGE' op
784
+ # and subseqeunt 'SEND_CLOSE_FROM_CLIENT' op of a bidi stream fails.
785
+ # In this case, iteration through the response stream should result
786
+ # in a grpc status code, and the writer thread should not raise an
787
+ # exception.
788
+ server_thread = Thread.new do
789
+ run_server_bidi_shutdown_after_one_read
790
+ end
791
+ stub = GRPC::ClientStub.new(@host, :this_channel_is_insecure)
792
+ request_queue = Queue.new
793
+ @sent_msgs = EnumeratorQueue.new(request_queue)
794
+ responses = get_responses(stub)
795
+ request_queue.push('first message')
796
+ # Now wait for the server to shut down.
797
+ server_thread.join
798
+ # Sanity check. This test is not interesting if
799
+ # Thread.abort_on_exception is not set.
800
+ expect(Thread.abort_on_exception).to be(true)
801
+ # An attempt to send a second message should fail now that the
802
+ # server is down.
803
+ request_queue.push('second message')
804
+ request_queue.push(nil)
805
+ expect { responses.next }.to raise_error(GRPC::BadStatus)
806
+ end
807
+
808
+ def run_server_bidi_shutdown_after_one_write
809
+ @server.start
810
+ recvd_rpc = @server.request_call
811
+ recvd_call = recvd_rpc.call
812
+ server_call = GRPC::ActiveCall.new(
813
+ recvd_call, noop, noop, INFINITE_FUTURE,
814
+ metadata_received: true, started: false)
815
+ server_call.send_initial_metadata
816
+ server_call.remote_send('message')
817
+ @server.shutdown_and_notify(from_relative_time(0))
818
+ @server.close
819
+ end
820
+
821
+ it 'receives a grpc status code when reading from a failed bidi call' do
822
+ server_thread = Thread.new do
823
+ run_server_bidi_shutdown_after_one_write
824
+ end
825
+ stub = GRPC::ClientStub.new(@host, :this_channel_is_insecure)
826
+ request_queue = Queue.new
827
+ @sent_msgs = EnumeratorQueue.new(request_queue)
828
+ responses = get_responses(stub)
829
+ expect(responses.next).to eq('message')
830
+ # Wait for the server to shut down
831
+ server_thread.join
832
+ expect { responses.next }.to raise_error(GRPC::BadStatus)
833
+ # Push a sentinel to allow the writer thread to finish
834
+ request_queue.push(nil)
835
+ end
836
+ end
753
837
  end
754
838
 
755
839
  describe 'without a call operation' do
@@ -810,6 +894,55 @@ describe 'ClientStub' do # rubocop:disable Metrics/BlockLength
810
894
  responses.each { |r| p r }
811
895
  end
812
896
  end
897
+
898
+ def run_server_bidi_expect_client_to_cancel(wait_for_shutdown_ok_callback)
899
+ @server.start
900
+ recvd_rpc = @server.request_call
901
+ recvd_call = recvd_rpc.call
902
+ server_call = GRPC::ActiveCall.new(
903
+ recvd_call, noop, noop, INFINITE_FUTURE,
904
+ metadata_received: true, started: false)
905
+ server_call.send_initial_metadata
906
+ server_call.remote_send('server call received')
907
+ wait_for_shutdown_ok_callback.call
908
+ # since the client is cancelling the call,
909
+ # we should be able to shut down cleanly
910
+ @server.shutdown_and_notify(nil)
911
+ @server.close
912
+ end
913
+
914
+ it 'receives a grpc status code when reading from a cancelled bidi call' do
915
+ # This test tries to trigger a 'RECV_INITIAL_METADATA' and/or
916
+ # 'RECV_MESSAGE' op failure.
917
+ # An attempt to read a message might fail; in that case, iteration
918
+ # through the response stream should still result in a grpc status.
919
+ server_can_shutdown = false
920
+ server_can_shutdown_mu = Mutex.new
921
+ server_can_shutdown_cv = ConditionVariable.new
922
+ wait_for_shutdown_ok_callback = proc do
923
+ server_can_shutdown_mu.synchronize do
924
+ server_can_shutdown_cv.wait(server_can_shutdown_mu) until server_can_shutdown
925
+ end
926
+ end
927
+ server_thread = Thread.new do
928
+ run_server_bidi_expect_client_to_cancel(wait_for_shutdown_ok_callback)
929
+ end
930
+ stub = GRPC::ClientStub.new(@host, :this_channel_is_insecure)
931
+ request_queue = Queue.new
932
+ @sent_msgs = EnumeratorQueue.new(request_queue)
933
+ responses = get_responses(stub)
934
+ expect(responses.next).to eq('server call received')
935
+ @op.cancel
936
+ expect { responses.next }.to raise_error(GRPC::Cancelled)
937
+ # Now let the server proceed to shut down.
938
+ server_can_shutdown_mu.synchronize do
939
+ server_can_shutdown = true
940
+ server_can_shutdown_cv.broadcast
941
+ end
942
+ server_thread.join
943
+ # Push a sentinel to allow the writer thread to finish
944
+ request_queue.push(nil)
945
+ end
813
946
  end
814
947
  end
815
948
 
@@ -0,0 +1,54 @@
1
+ # Copyright 2016 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 'open3'
16
+ require 'tmpdir'
17
+
18
+ def debug_mode?
19
+ !ENV['CONFIG'].nil? && ENV['CONFIG'] == 'dbg'
20
+ end
21
+
22
+ describe 'Package with underscore protobuf code generation' do
23
+ it 'should have the same content as created by code generation' do
24
+ root_dir = File.join(File.dirname(__FILE__), '..', '..', '..', '..', '..')
25
+ pb_dir = File.join(root_dir, 'src', 'ruby', 'spec', 'pb')
26
+
27
+ bins_sub_dir = debug_mode? ? 'dbg' : 'opt'
28
+ bins_dir = File.join(root_dir, 'bins', bins_sub_dir)
29
+
30
+ plugin = File.join(bins_dir, 'grpc_ruby_plugin')
31
+ protoc = File.join(bins_dir, 'protobuf', 'protoc')
32
+
33
+ got = nil
34
+
35
+ Dir.mktmpdir do |tmp_dir|
36
+ gen_out = File.join(tmp_dir, 'package_with_underscore', 'service_services_pb.rb')
37
+
38
+ pid = spawn(
39
+ protoc,
40
+ '-I.',
41
+ 'package_with_underscore/service.proto',
42
+ "--grpc_out=#{tmp_dir}",
43
+ "--plugin=protoc-gen-grpc=#{plugin}",
44
+ chdir: pb_dir)
45
+ Process.waitpid2(pid)
46
+ File.open(gen_out) { |f| got = f.read }
47
+ end
48
+
49
+ correct_modularized_rpc = 'rpc :TestOne, ' \
50
+ 'Grpc::Testing::PackageWithUnderscore::Data::Request, ' \
51
+ 'Grpc::Testing::PackageWithUnderscore::Data::Response'
52
+ expect(got).to include(correct_modularized_rpc)
53
+ end
54
+ end
@@ -0,0 +1,23 @@
1
+ // Copyright 2018 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
+ syntax = "proto3";
16
+
17
+ package grpc.testing.package_with_underscore.data;
18
+
19
+ message Request {
20
+ }
21
+
22
+ message Response {
23
+ }
@@ -0,0 +1,23 @@
1
+ // Copyright 2018 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
+ syntax = "proto3";
16
+
17
+ package grpc.testing.package_with_underscore.service;
18
+
19
+ import "package_with_underscore/data.proto";
20
+
21
+ service MyService {
22
+ rpc TestOne(data.Request) returns (data.Response) {}
23
+ }
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.10.0
4
+ version: 1.11.0.pre2
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: 2018-03-01 00:00:00.000000000 Z
11
+ date: 2018-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -265,7 +265,6 @@ files:
265
265
  - src/ruby/lib/grpc/generic/service.rb
266
266
  - src/ruby/lib/grpc/google_rpc_status_utils.rb
267
267
  - src/ruby/lib/grpc/grpc.rb
268
- - src/ruby/lib/grpc/grpc_c.so
269
268
  - src/ruby/lib/grpc/logconfig.rb
270
269
  - src/ruby/lib/grpc/notifier.rb
271
270
  - src/ruby/lib/grpc/version.rb
@@ -304,6 +303,9 @@ files:
304
303
  - src/ruby/spec/google_rpc_status_utils_spec.rb
305
304
  - src/ruby/spec/pb/duplicate/codegen_spec.rb
306
305
  - src/ruby/spec/pb/health/checker_spec.rb
306
+ - src/ruby/spec/pb/package_with_underscore/checker_spec.rb
307
+ - src/ruby/spec/pb/package_with_underscore/data.proto
308
+ - src/ruby/spec/pb/package_with_underscore/service.proto
307
309
  - src/ruby/spec/server_credentials_spec.rb
308
310
  - src/ruby/spec/server_spec.rb
309
311
  - src/ruby/spec/spec_helper.rb
@@ -336,9 +338,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
336
338
  version: '2.6'
337
339
  required_rubygems_version: !ruby/object:Gem::Requirement
338
340
  requirements:
339
- - - ">="
341
+ - - ">"
340
342
  - !ruby/object:Gem::Version
341
- version: '0'
343
+ version: 1.3.1
342
344
  requirements: []
343
345
  rubyforge_project:
344
346
  rubygems_version: 2.7.6
@@ -346,36 +348,39 @@ signing_key:
346
348
  specification_version: 4
347
349
  summary: GRPC system in Ruby
348
350
  test_files:
349
- - src/ruby/spec/server_spec.rb
350
- - src/ruby/spec/support/services.rb
351
- - src/ruby/spec/support/helpers.rb
352
- - src/ruby/spec/channel_spec.rb
353
- - src/ruby/spec/client_auth_spec.rb
354
- - src/ruby/spec/testdata/README
355
- - src/ruby/spec/testdata/ca.pem
356
- - src/ruby/spec/testdata/server1.key
357
- - src/ruby/spec/testdata/client.pem
358
- - src/ruby/spec/testdata/server1.pem
359
- - src/ruby/spec/testdata/client.key
351
+ - src/ruby/spec/spec_helper.rb
360
352
  - src/ruby/spec/time_consts_spec.rb
361
- - src/ruby/spec/google_rpc_status_utils_spec.rb
362
- - src/ruby/spec/channel_connection_spec.rb
363
353
  - src/ruby/spec/call_spec.rb
354
+ - src/ruby/spec/google_rpc_status_utils_spec.rb
364
355
  - src/ruby/spec/generic/rpc_server_spec.rb
365
- - src/ruby/spec/generic/server_interceptors_spec.rb
366
- - src/ruby/spec/generic/client_interceptors_spec.rb
356
+ - src/ruby/spec/generic/service_spec.rb
367
357
  - src/ruby/spec/generic/rpc_desc_spec.rb
368
- - src/ruby/spec/generic/active_call_spec.rb
369
358
  - src/ruby/spec/generic/client_stub_spec.rb
370
359
  - src/ruby/spec/generic/rpc_server_pool_spec.rb
371
360
  - src/ruby/spec/generic/interceptor_registry_spec.rb
372
- - src/ruby/spec/generic/service_spec.rb
373
- - src/ruby/spec/pb/duplicate/codegen_spec.rb
374
- - src/ruby/spec/pb/health/checker_spec.rb
375
- - src/ruby/spec/client_server_spec.rb
376
- - src/ruby/spec/compression_options_spec.rb
377
- - src/ruby/spec/server_credentials_spec.rb
378
- - src/ruby/spec/spec_helper.rb
361
+ - src/ruby/spec/generic/client_interceptors_spec.rb
362
+ - src/ruby/spec/generic/server_interceptors_spec.rb
363
+ - src/ruby/spec/generic/active_call_spec.rb
364
+ - src/ruby/spec/client_auth_spec.rb
379
365
  - src/ruby/spec/error_sanity_spec.rb
366
+ - src/ruby/spec/server_credentials_spec.rb
367
+ - src/ruby/spec/client_server_spec.rb
380
368
  - src/ruby/spec/channel_credentials_spec.rb
369
+ - src/ruby/spec/support/helpers.rb
370
+ - src/ruby/spec/support/services.rb
371
+ - src/ruby/spec/compression_options_spec.rb
372
+ - src/ruby/spec/pb/package_with_underscore/service.proto
373
+ - src/ruby/spec/pb/package_with_underscore/checker_spec.rb
374
+ - src/ruby/spec/pb/package_with_underscore/data.proto
375
+ - src/ruby/spec/pb/duplicate/codegen_spec.rb
376
+ - src/ruby/spec/pb/health/checker_spec.rb
381
377
  - src/ruby/spec/call_credentials_spec.rb
378
+ - src/ruby/spec/channel_connection_spec.rb
379
+ - src/ruby/spec/testdata/README
380
+ - src/ruby/spec/testdata/server1.pem
381
+ - src/ruby/spec/testdata/server1.key
382
+ - src/ruby/spec/testdata/ca.pem
383
+ - src/ruby/spec/testdata/client.pem
384
+ - src/ruby/spec/testdata/client.key
385
+ - src/ruby/spec/server_spec.rb
386
+ - src/ruby/spec/channel_spec.rb
Binary file