Giter Club home page Giter Club logo

grpc-ios's Introduction

gRPC โ€“ An RPC library and framework

gRPC is a modern, open source, high-performance remote procedure call (RPC) framework that can run anywhere. gRPC enables client and server applications to communicate transparently, and simplifies the building of connected systems.

Homepage: grpc.io
Mailing List: [email protected]

Join the chat at https://gitter.im/grpc/grpc

To start using gRPC

To maximize usability, gRPC supports the standard method for adding dependencies to a user's chosen language (if there is one). In most languages, the gRPC runtime comes as a package available in a user's language package manager.

For instructions on how to use the language-specific gRPC runtime for a project, please refer to these documents

  • C++: follow the instructions under the src/cpp directory
  • C#/.NET: NuGet packages Grpc.Net.Client, Grpc.AspNetCore.Server
  • Dart: pub package grpc
  • Go: go get google.golang.org/grpc
  • Java: Use JARs from Maven Central Repository
  • Kotlin: Use JARs from Maven Central Repository
  • Node: npm install @grpc/grpc-js
  • Objective-C: Add gRPC-ProtoRPC dependency to podspec
  • PHP: pecl install grpc
  • Python: pip install grpcio
  • Ruby: gem install grpc
  • WebJS: follow the grpc-web instructions

Per-language quickstart guides and tutorials can be found in the documentation section on the grpc.io website. Code examples are available in the examples directory.

Precompiled bleeding-edge package builds of gRPC master branch's HEAD are uploaded daily to packages.grpc.io.

To start developing gRPC

Contributions are welcome!

Please read How to contribute which will guide you through the entire workflow of how to build the source code, how to run the tests, and how to contribute changes to the gRPC codebase. The "How to contribute" document also contains info on how the contribution process works and contains best practices for creating contributions.

Troubleshooting

Sometimes things go wrong. Please check out the Troubleshooting guide if you are experiencing issues with gRPC.

Performance

See the Performance dashboard for performance numbers of master branch daily builds.

Concepts

See gRPC Concepts

About This Repository

This repository contains source code for gRPC libraries implemented in multiple languages written on top of a shared C++ core library src/core.

Libraries in different languages may be in various states of development. We are seeking contributions for all of these libraries:

Language Source
Shared C++ [core library] src/core
C++ src/cpp
Ruby src/ruby
Python src/python
PHP src/php
C# (core library based) src/csharp
Objective-C src/objective-c
Language Source repo
Java grpc-java
Kotlin grpc-kotlin
Go grpc-go
NodeJS grpc-node
WebJS grpc-web
Dart grpc-dart
.NET (pure C# impl.) grpc-dotnet
Swift grpc-swift

grpc-ios's People

Contributors

dennycd avatar github-actions[bot] avatar hannahshisfb avatar yulin-liang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grpc-ios's Issues

Bazel migration for ObjC Unit Test Suite

Migrate existing gRPC ObjC unit test suite to bazel-based test

Current Test Setup

Current test utilize a Cocoapod project target for unit test, and integrated with kokoro CI via script

The script involves two major stage: pod installation and xcodebuild test run.

Its corresponding kokoro test components at

New Setup

We will define new ios_unit_test target for Unit Test and may utilize the following script for bazel integration w/ kokoro


Also we should enable GRPC_VERBOSITY=debug environment variable when running these tests


cc @jtattermusch

iOS Interop Test Refactor and Cleanup

General clean up and refactoring of existing Interop test suite 's structure

  • Avoid test suite subclassing anti-pattern in favor of delegation & component configuration

iOS unit test for C-Core's libuv-based timer implementation

For verifying libuv timer's usability for iOS, add unit test coverage to EventEngineTimerTests test suite. This can closely mirror existing c-core's test logic at

Note that in order to test libuv timer, it requires the libuv-timer impl PR to land and instantiation of grpc_event_engine::experimental::LibuvEventEngine as mentioned in libuv_event_engine_test.cc

gRPC release branching dry run

Create gRPC-iOS release branching and release tags

  • Create and use target branch grpc_release_vX.YZ
  • Script to pull in corresponding C-core release tag and checkin to native shallow copy source.
  • Workflow bot to automate the process with C-core release tag trigger (if possible)

gRPC pod migration

  • Migrate gRPC.podspec to gRPC-iOS.
  • Release pod from gRPC-iOS repo

Note that all upstream pod specs should be pointing to local shallow copy, or a mgirated pod that has been migrated or released from gRPC-iOS.

Cocoapod build test coverage

Migrate and/or create build test coverage for pods managed by iOS/ObjC stack, these includes

  • Objc Wrapper Pod (gRPC, gRPC-ProtoRPC, gRPC-RxLibrary)
  • Native C-Core Pod (gRPC-C++, gRPC-Core)

The build test should be triggered in the following brach and scenarios

  • grpc_master branch upon shallow copy source code sync (daily)
  • grpc_release branch upon release tag creation (per grpc schedule)
  • PR presubmit (in the future)

CFStream Test Suite Bazel Migration

Our CFStream test suite currently have a few issues that need to be improved

  • Test hangs and keep retries until timeout if test failure
  • Async test logic is using NSRunLoop mainRunLoop instead of XCTestExpectation

In addition, the current test suite is an objc translation from existing c-core test

We should revisit the test setup to run c-core's test setup using the corresponding ios unit test target instead


Additional todos for CFStream Test Update

  • Migrate CFStream test to bazel based
  • Move CFStream test out of test/core/iomgr and move into src/objective-c so that it is co-located with the rest of the ios/objc test.

iOS cpp core test crash on rls_end2end_test:DuplicateHeadersAreMerged

Sample failure log

First introduced via PR

Crash on test case DuplicateHeadersAreMerged with the following error

Test Case '-[GTMGoogleTestRunner RlsEnd2endTest::DuplicateHeadersAreMerged]' started.
E1025 11:55:03.334006000 4675941824 lb_policy_registry.cc:45]          assertion failed: strcmp(factories_[i]->name(), factory->name()) != 0
Child process terminated with signal 6: Abort trap
2021-10-25 18:55:03,337 Deleting simulator B98849B0-9930-4F52-9042-26010265B1F5 asynchronously.
2021-10-25 18:55:03,343 Done.
================================================================================
Target //test/cpp/end2end:rls_end2end_test_on_ios up-to-date:
  bazel-bin/test/cpp/end2end/rls_end2end_test_on_ios
  bazel-out/applebin_ios-ios_x86_64-fastbuild-ST-e637a0adc749/bin/test/cpp/end2end/rls_end2end_test_on_ios.zip
INFO: Elapsed time: 17.652s, Critical Path: 16.50s
INFO: 55 processes: 31 internal, 23 darwin-sandbox, 1 local.
INFO: Build completed, 1 test FAILED, 55 total actions
//test/cpp/end2end:rls_end2end_test_on_ios                               FAILED in 2.3s
    ERROR   .test/cpp/end2end/rls_end2end_test_on_ios (0.0s)

GRPCClientTests testTimeoutBackoff2 test failure

https://source.cloud.google.com/results/invocations/39899e9f-d958-42de-b0c3-8c2b9427ca49/targets/grpc%2Fcore%2Fmaster%2Fmacos%2Fgrpc_basictests_objc_ios/log

Fri Sep 17 00:56:37 PDT 2021 - Test Case '-[GRPCClientTests testTimeoutBackoff2]' started.
Fri Sep 17 00:56:37 PDT 2021 - 2021-09-17 00:56:37.576055-0700 xctest[41153:78530] [] nw_socket_handle_socket_event [C22:1] Socket SO_ERROR [61: Connection refused]
Fri Sep 17 00:56:37 PDT 2021 - 2021-09-17 00:56:37.577751-0700 xctest[41153:78530] [] nw_connection_get_connected_socket [C22] Client called nw_connection_get_connected_socket on unconnected nw_connection
Fri Sep 17 00:56:37 PDT 2021 - 2021-09-17 00:56:37.582215-0700 xctest[41153:78530] TCP Conn 0x7fd4a45aaa70 Failed : error 0:61 [61]
Fri Sep 17 00:56:37 PDT 2021 - 2021-09-17 00:56:37.595044-0700 xctest[41153:78530] [] nw_socket_handle_socket_event [C23:1] Socket SO_ERROR [61: Connection refused]
Fri Sep 17 00:56:37 PDT 2021 - 2021-09-17 00:56:37.598824-0700 xctest[41153:78732] [] nw_connection_get_connected_socket [C23] Client called nw_connection_get_connected_socket on unconnected nw_connection
Fri Sep 17 00:56:37 PDT 2021 - 2021-09-17 00:56:37.603653-0700 xctest[41153:78732] TCP Conn 0x7fd4a45adee0 Failed : error 0:61 [61]
Fri Sep 17 00:56:38 PDT 2021 - /Volumes/BuildData/tmpfs/src/github/grpc/workspace_objc_macos_opt_native/src/objective-c/tests/UnitTests/GRPCClientTests.m:589: error: -[GRPCClientTests testTimeoutBackoff2] : (([[NSDate date] timeIntervalSinceDate:startTime]) less than (maxConnectTime + kMargin)) failed: ("0.843600988388") is not less than ("0.8")
Fri Sep 17 00:56:38 PDT 2021 - Test Case '-[GRPCClientTests testTimeoutBackoff2]' failed (0.847 seconds).

Create SPM target for ObjC client targets

Create SPM ObjC target for the following corresponding pod target

  • gRPC-ProtoRPC for ObjC V2 API and dependencies
  • gRPC for ObjC V1 legacy API and dependencies

These targets should be under top level Package.swift and upstream dependencies should be referencing grpc native c-core's shallow content instead of pulling from gRPC c-core repo.

Remove cocoapod's post-install header rewrite

At the moment, post pod installation, all gRPC/ObjcC pod is using prepare_command to rewrite c++ core / external lib's include headers in order to accomodate iOS/Xcode search path. This creates various issues and very error prone.

Instead we should look at avoid modifying the source and adjust build header search path at Cocoapoad/Xcode configuration level.

Bazel Migration for gRPC ObjC Interop Test

Migrate existing Cocoapod based Interop test suite to bazel

Existing pod test target defined in

Its corresponding kokoro run component at

Also we should enable GRPC_VERBOSITY=debug environment variable when running these tests


cc @jtattermusch

Detect missing podspec imports

At the moment, generated_projects.sh will automatically add new source file to the main spec, however, additional podspec imports may still be needed to avoid linkage-time symbol missing issue. See PR example here: grpc/grpc#27032

Check if there is a way to automatically detect missing imports or surface up the missing steps to devs.

Setup ios bazel test to run c-core's existing event_engine unit test

Setup bazel ios_unit_test and test against C-core's existing event engine test suite

Existing c-core unit test on iOS is done via the following bazel rule

on iOS/Mac, we run the following script to trigger bazel test on kokoro CI

This is test against all ios_unit_test targets under //test/cpp. We can setup a similar structure for event engine test target


Sample instruction to run bazel ios test in command line

tools/bazel query "kind(ios_unit_test, tests(//test/core/event_engine/...))" 

tools/bazel test --test_summary=detailed --test_output=all //test/core/event_engine:endpoint_config_test_on_ios 

ios cronet test suite crash due to port server not running

observing high frequent cronet test time out on both pre-submit and prod/master's grpc_basictests_objc_ios test suite. One of the following sample log captures the issue from cronet test suite crash due to python port server not running. XCTest attempts to restart the test and eventually leads to timeout being reported

Mon Nov  1 11:37:54 PDT 2021 - Test Case '-[CoreCronetEnd2EndTests testCancelAfterClientDone]' started.
Mon Nov  1 11:38:04 PDT 2021 - gRPC tests require a helper port server to allocate ports used
Mon Nov  1 11:38:04 PDT 2021 - during the test.
Mon Nov  1 11:38:04 PDT 2021 -
Mon Nov  1 11:38:04 PDT 2021 - This server is not currently running.
Mon Nov  1 11:38:04 PDT 2021 -
Mon Nov  1 11:38:04 PDT 2021 - To start it, run tools/run_tests/start_port_server.py
Mon Nov  1 11:38:04 PDT 2021 -
Mon Nov  1 11:38:25 PDT 2021 -
Mon Nov  1 11:38:25 PDT 2021 - Restarting after unexpected exit or crash in CoreCronetEnd2EndTests/testCancelAfterClientDone; summary will include totals from previous launches.
Mon Nov  1 11:38:25 PDT 2021 -

most sample test log doesn't capture the above crash, but instead reporting time out with the last test suite being ios cronet test,

2021-11-01 14:50:10,768 START: ios-test-cronettests

2021-11-01 15:16:45,843 TIMEOUT: run_tests_objc_macos_opt_native [pid=3790, time=5402.6sec]
2021-11-01 15:16:45,856 FAILED: Some run_tests.py instances have failed.

This is followed by another script check agains the port server existence w/ exit failure

+ FAILED=true
+ ps aux
+ grep 'port_server\.py'
+ awk '{print $2}'
+ xargs kill -9
...
real	0m13.275s
user	0m0.359s
sys	0m8.198s
+ '[' true '!=' '' ']'
+ exit 1

Automate Cocoapod Release Process

Automate Cocoapod release with the following steps

  • Scripts to simplify building and release pod for a target podspec and from a release tag
  • Workflow bot that automate the pod release

This should also coordinates w/ gRPC-iOS cocoapod migration so that

  • We release from grpc-ios/grpc_release branch and corresponding release tags
  • Release using podspecs from gRPC-iOS repo (Objc pods) and native shallow copy for native pods (gRPC-C++, gRPC-Core)

iOS CoreTest coverage for libuv's dns resolver component

Update gRPC ObjC test script to support structured test results in kokoro UI

Update bazel-based gRPC ObjC test to support generating structured test logs that can be rendered by kokoro UI. Specifically, look into existing c++'s bazel test scripts examples

Prior PR for structured test results at


@HannahShiSFB @jtattermusch

Fix GRPCCallOptions's retry property handling

On GRPCCallOptions, the following properties are currently not copied over

  • @Property(atomic, assign) NSTimeInterval maxRetryInterval;
  • @Property(atomic, assign) NSTimeInterval minRetryInterval;
  • @Property(atomic, assign) NSUInteger retryCount;
  • @Property(atomic, assign) double retryFactor;

In addition, these are currently marked readwrite on immutable option class GRPCCallOptions, and should be moved to GRPCMutableCallOptions instead.

Cronet cpp ios test crash

Observed a number of test breakage on cpp cronet test targets

Looks like all test cases crashed with the following error messages

Wed Oct 20 09:56:47 PDT 2021 - 2021-10-20 09:56:47.779436-0700 xctest[31851:63940] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/kbuilder/Library/Developer/CoreSimulator/Devices/4F9376BD-4079-49A7-BB18-AED93CEEBE0B/data/Library/Cookies/com.apple.dt.xctest.tool.binarycookies
Wed Oct 20 09:56:47 PDT 2021 - xctest(31851,0x11151f5c0) malloc: *** error for object 0x2000000000000000: pointer being freed was not allocated
Wed Oct 20 09:56:47 PDT 2021 - xctest(31851,0x11151f5c0) malloc: *** set a breakpoint in malloc_error_break to debug
Wed Oct 20 09:58:30 PDT 2021 -
Wed Oct 20 09:58:30 PDT 2021 - Restarting after unexpected exit or crash in CppCronetEnd2EndTests/testBidiStream; summary will include totals from previous launches.

A few errors message related to cronet failure

ed Oct 20 09:56:47 PDT 2021 - [1020/095647.771493:ERROR:cronet_environment.mm(157)] Can not start NetLog to /Users/kbuilder/Library/Developer/CoreSimulator/Devices/4F9376BD-4079-49A7-BB18-AED93CEEBE0B/data/Documents/cronet_netlog.json: Undefined error: 0

CoreCronetEnd2EndTests testCompressedPayload assertion failure

CallAPIv2Tests testMetadata and testErrorDebugInformation failure

See the following sample

Wed Sep 15 21:00:52 PDT 2021 - Test Case '-[CallAPIv2Tests testMetadata]' started.
Wed Sep 15 21:01:01 PDT 2021 - /Volumes/BuildData/tmpfs/src/github/grpc/workspace_objc_macos_opt_native/src/objective-c/tests/UnitTests/APIv2Tests.m:205: error: -[CallAPIv2Tests testMetadata] : Asynchronous wait failed: Exceeded timeout of 8 seconds, with unfulfilled expectations: "RPC unauthorized.".
Wed Sep 15 21:01:01 PDT 2021 - Test Case '-[CallAPIv2Tests testMetadata]' failed (8.465 seconds).

In addition, testErrorDebugInformation raises NSInternalInconsistencyException as follows

Wed Sep 15 21:01:15 PDT 2021 - 2021-09-15 21:01:15.822864-0700 xctest[41458:80151] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to report test assertion failure '((error.code) equal to (16)) failed: throwing "Unable to report test assertion failure '((error.code) equal to (16)) failed: ("14") is not equal to ("16") - Finished with unexpected error: Error Domain=io.grpc Code=14 "{"created":"@1631764875.804842000","description":"Error received from peer ipv6:[2607:f8b0:4002:c11::451]:443","file":"/Volumes/BuildData/tmpfs/src/github/grpc/workspace_objc_macos_opt_native/src/core/lib/surface/call.cc","file_line":1074,"grpc_message":"502:Bad Gateway","grpc_status":14}" UserInfo={io.grpc.HeadersKey={

Also looks like we have

Handle iOS sample app build break when BoringSSL & Libuv version update

Currently if we modify gRPC-Core's BoringSSL & Libuv version number w/o publishing the pod for the new version, our iOS sample app project will break since the next pod install won't be able to find the updated version from the pod trunk (see example grpc/grpc#27710). A few action items

  • we need to add presubmit build test to kokoro that builds an iOS app pod using the updated version from cocoapod trunk. This helps detect build breaks
  • Update iOS release process so that this version bump are in sync w/ cocoapod trunk udpate

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.