Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a defect in RPC Framework Core #4818

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix a defect in RPC Framework Core
On the service-side, an operation isn't successfully completed with
just the conclusion of transmission to the other side; local ingestion
of the status and code must be completed as well before termination
callbacks are called.
  • Loading branch information
nathanielmanistaatgoogle committed Jan 21, 2016
commit 4a9b1c69880db4fa8b41d14c9b91870332e07746
6 changes: 3 additions & 3 deletions src/python/grpcio/grpc/framework/core/_termination.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2015, Google Inc.
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -46,8 +46,8 @@ def _invocation_completion_predicate(

def _service_completion_predicate(
unused_emission_complete, transmission_complete, unused_reception_complete,
unused_ingestion_complete):
return transmission_complete
ingestion_complete):
return transmission_complete and ingestion_complete


class TerminationManager(_interfaces.TerminationManager):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2015, Google Inc.
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -49,5 +49,8 @@
# The size of payloads to transmit in tests.
PAYLOAD_SIZE = 256 * 1024 + 17

# The parallelism to use in tests of parallel RPCs.
PARALLELISM = 200

# The size of thread pools to use in tests.
POOL_SIZE = 10
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2015, Google Inc.
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -219,6 +219,24 @@ def testSequentialInvocations(self):

test_messages.verify(second_request, second_response, self)

for (group, method), test_messages_sequence in (
self._digest.unary_unary_messages_sequences.iteritems()):
for test_messages in test_messages_sequence:
requests = []
response_futures = []
for _ in range(test_constants.PARALLELISM):
request = test_messages.request()
response_future = self._invoker.future(group, method)(
request, test_constants.LONG_TIMEOUT)
requests.append(request)
response_futures.append(response_future)

responses = [
response_future.result() for response_future in response_futures]

for request, response in zip(requests, responses):
test_messages.verify(request, response, self)

def testParallelInvocations(self):
for (group, method), test_messages_sequence in (
self._digest.unary_unary_messages_sequences.iteritems()):
Expand Down