Fixed bug in cronet_transport where completed ops were not removed from storage

pull/20464/head
Prashant Jaikumar 5 years ago
parent 04495e5488
commit 4bb7731d5b
  1. 21
      src/core/ext/transport/cronet/transport/cronet_transport.cc
  2. 3
      src/objective-c/tests/ConfigureCronet.h
  3. 6
      src/objective-c/tests/ConfigureCronet.m
  4. 2
      src/objective-c/tests/CronetTests/CoreCronetEnd2EndTests.mm
  5. 2
      src/objective-c/tests/CronetTests/CronetUnitTests.mm
  6. 2
      src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m
  7. 2
      src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m
  8. 38
      src/objective-c/tests/PerfTests/PerfTests.m
  9. 2
      src/objective-c/tests/PerfTests/PerfTestsCronet.m

@ -1348,21 +1348,26 @@ static enum e_op_result execute_stream_op(struct op_and_state* oas) {
stream_state->cancel_error =
GRPC_ERROR_REF(stream_op->payload->cancel_stream.cancel_error);
}
} else if (stream_op->on_complete &&
op_can_be_run(stream_op, s, &oas->state, OP_ON_COMPLETE)) {
} else if (op_can_be_run(stream_op, s, &oas->state, OP_ON_COMPLETE)) {
CRONET_LOG(GPR_DEBUG, "running: %p OP_ON_COMPLETE", oas);
if (stream_state->state_op_done[OP_CANCEL_ERROR]) {
GRPC_CLOSURE_SCHED(stream_op->on_complete,
GRPC_ERROR_REF(stream_state->cancel_error));
if (stream_op->on_complete) {
GRPC_CLOSURE_SCHED(stream_op->on_complete,
GRPC_ERROR_REF(stream_state->cancel_error));
}
} else if (stream_state->state_callback_received[OP_FAILED]) {
GRPC_CLOSURE_SCHED(
stream_op->on_complete,
make_error_with_desc(GRPC_STATUS_UNAVAILABLE, "Unavailable."));
if (stream_op->on_complete) {
GRPC_CLOSURE_SCHED(
stream_op->on_complete,
make_error_with_desc(GRPC_STATUS_UNAVAILABLE, "Unavailable."));
}
} else {
/* All actions in this stream_op are complete. Call the on_complete
* callback
*/
GRPC_CLOSURE_SCHED(stream_op->on_complete, GRPC_ERROR_NONE);
if (stream_op->on_complete) {
GRPC_CLOSURE_SCHED(stream_op->on_complete, GRPC_ERROR_NONE);
}
}
oas->state.state_op_done[OP_ON_COMPLETE] = true;
oas->done = true;

@ -15,6 +15,7 @@
* limitations under the License.
*
*/
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
@ -23,7 +24,7 @@ extern "C" {
/**
* Enable Cronet for once.
*/
void configureCronet(void);
void configureCronet(bool enable_netlog);
#ifdef __cplusplus
}

@ -19,7 +19,7 @@
#import "ConfigureCronet.h"
#import <Cronet/Cronet.h>
void configureCronet(void) {
void configureCronet(bool enable_netlog) {
static dispatch_once_t configureCronet;
dispatch_once(&configureCronet, ^{
NSLog(@"configureCronet()");
@ -29,7 +29,9 @@ void configureCronet(void) {
NSURL *url = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory
inDomains:NSUserDomainMask] lastObject];
NSLog(@"Documents directory: %@", url);
if (enable_netlog) {
[Cronet startNetLogToFile:@"cronet_netlog.json" logBytes:YES];
}
[Cronet start];
[Cronet startNetLogToFile:@"cronet_netlog.json" logBytes:YES];
});
}

@ -177,7 +177,7 @@ static char *roots_filename;
grpc_init();
configureCronet();
configureCronet(/*enable_netlog=*/false);
}
// The tearDown() function is run after all test cases finish running

@ -64,7 +64,7 @@ static void drain_cq(grpc_completion_queue *cq) {
grpc_test_init(1, argv);
grpc_init();
configureCronet();
configureCronet(/*enable_netlog=*/false);
init_ssl();
}

@ -42,7 +42,7 @@ static int32_t kRemoteInteropServerOverhead = 12;
@implementation InteropTestsRemoteWithCronet
+ (void)setUp {
configureCronet();
configureCronet(/*enable_netlog=*/false);
[GRPCCall useCronetWithEngine:[Cronet getGlobalEngine]];
[super setUp];

@ -85,7 +85,7 @@ dispatch_once_t initCronet;
self.continueAfterFailure = NO;
_remoteService = [RMTTestService serviceWithHost:kRemoteSSLHost callOptions:nil];
configureCronet();
configureCronet(/*enable_netlog=*/false);
// Default stack with remote host
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];

@ -143,8 +143,8 @@ extern const char *kCFStreamVarName;
messageCallback:^(id message) {
int indexCopy;
@synchronized(self) {
index += 1;
indexCopy = index;
index += 1;
}
if (indexCopy < numMessages) {
[call writeMessage:request];
@ -181,7 +181,7 @@ extern const char *kCFStreamVarName;
[self pingPongV2APIWithRequest:request numMessages:1000 options:options];
[self measureBlock:^{
[self pingPongV2APIWithRequest:request numMessages:10000 options:options];
[self pingPongV2APIWithRequest:request numMessages:1000 options:options];
}];
}
@ -198,7 +198,7 @@ extern const char *kCFStreamVarName;
[self pingPongV2APIWithRequest:request numMessages:1000 options:options];
[self measureBlock:^{
[self pingPongV2APIWithRequest:request numMessages:10000 options:options];
[self pingPongV2APIWithRequest:request numMessages:1000 options:options];
}];
}
@ -215,7 +215,7 @@ extern const char *kCFStreamVarName;
[self pingPongV2APIWithRequest:request numMessages:1000 options:options];
[self measureBlock:^{
[self pingPongV2APIWithRequest:request numMessages:10000 options:options];
[self pingPongV2APIWithRequest:request numMessages:1000 options:options];
}];
}
@ -254,7 +254,7 @@ extern const char *kCFStreamVarName;
id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:@1 requestedResponseSize:@1];
[self pingPongV1APIWithRequest:request numMessages:1000];
[self measureBlock:^{
[self pingPongV1APIWithRequest:request numMessages:10000];
[self pingPongV1APIWithRequest:request numMessages:1000];
}];
}
@ -298,7 +298,7 @@ extern const char *kCFStreamVarName;
[self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil];
}
- (void)testUnaryRPC {
- (void)test1MBUnaryRPC {
// Workaround Apple CFStream bug
if ([self isUsingCFStream]) {
return;
@ -329,6 +329,32 @@ extern const char *kCFStreamVarName;
}];
}
- (void)test1KBUnaryRPC {
RMTSimpleRequest *request = [RMTSimpleRequest message];
request.responseSize = 1024;
request.payload.body = [NSMutableData dataWithLength:1024];
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
options.transport = [[self class] transport];
options.PEMRootCertificates = [[self class] PEMRootCertificates];
options.hostNameOverride = [[self class] hostNameOverride];
// warm up
[self unaryRPCsWithServices:@[ self->_service ]
request:request
callsPerService:1000
maxOutstandingCalls:100
callOptions:options];
[self measureBlock:^{
[self unaryRPCsWithServices:@[ self->_service ]
request:request
callsPerService:1000
maxOutstandingCalls:100
callOptions:options];
}];
}
- (void)testMultipleChannels {
NSString *port = [[[self class] host] componentsSeparatedByString:@":"][1];
int kNumAddrs = 10;

@ -42,7 +42,7 @@ static int32_t kRemoteInteropServerOverhead = 12;
@implementation PerfTestsCronet
+ (void)setUp {
configureCronet();
configureCronet(/*enable_netlog=*/false);
[GRPCCall useCronetWithEngine:[Cronet getGlobalEngine]];
[super setUp];

Loading…
Cancel
Save