Skip to content

Upgrade c-ares to 1.13.0#12305

Merged
jtattermusch merged 17 commits intogrpc:masterfrom
jtattermusch:cares_bump_1_13
Sep 10, 2017
Merged

Upgrade c-ares to 1.13.0#12305
jtattermusch merged 17 commits intogrpc:masterfrom
jtattermusch:cares_bump_1_13

Conversation

@jtattermusch
Copy link
Copy Markdown
Contributor

-- starting from this version, c-ares has its own support for cmake, switch to using c-ares cmake
-- update ares_build.h and ares_config.h that's used for bazel build & Makefile build

Using c-ares' cmake is useful because it supports installing c-ares, which is in turn needed for properly supporting installing gRPC as a cmake package (I have some in-progress work to improve gRPC's cmake build).

@jtattermusch
Copy link
Copy Markdown
Contributor Author

@y-zeng Where can I find a freebsd machine to regenerate the ares_config.h?

@y-zeng
Copy link
Copy Markdown
Contributor

y-zeng commented Aug 28, 2017

@jtattermusch Thanks for doing this upgrade!
@mehrdada Do you know where we can find a freebsd machine to regenerate the ares_config.h?

@grpc-kokoro
Copy link
Copy Markdown
Collaborator

Corrupt JSON data (indicates timeout or crash): 
    bm_fullstack_trickle.BM_PumpStreamServerToClient_Trickle_8_4k.opt.new: 1


[trickle] No significant performance differences

@grpc-kokoro
Copy link
Copy Markdown
Collaborator

[microbenchmarks] Performance differences noted:
Benchmark                                                                               cpu_time    real_time
--------------------------------------------------------------------------------------  ----------  -----------
BM_PumpStreamServerToClient<InProcess>/256k                                             -6%         -5%
BM_StreamingPingPong<InProcess, NoOpMutator, NoOpMutator>/32k/2                         +4%         +4%
BM_StreamingPingPong<MinInProcess, NoOpMutator, NoOpMutator>/256k/2                     +4%         +4%
BM_StreamingPingPongMsgs<InProcess, NoOpMutator, NoOpMutator>/32k                       +5%         +5%
BM_StreamingPingPongMsgs<MinInProcess, NoOpMutator, NoOpMutator>/256k                   +6%         +6%
BM_StreamingPingPongMsgs<MinInProcess, NoOpMutator, NoOpMutator>/32k                    +11%        +11%
BM_StreamingPingPongWithCoalescingApi<InProcess, NoOpMutator, NoOpMutator>/256k/1/1     +9%         +9%
BM_StreamingPingPongWithCoalescingApi<InProcess, NoOpMutator, NoOpMutator>/32k/1/1      +8%         +8%
BM_StreamingPingPongWithCoalescingApi<InProcess, NoOpMutator, NoOpMutator>/32k/2/1      +11%        +11%
BM_StreamingPingPongWithCoalescingApi<MinInProcess, NoOpMutator, NoOpMutator>/256k/1/0  +9%         +10%
BM_StreamingPingPongWithCoalescingApi<MinInProcess, NoOpMutator, NoOpMutator>/32k/1/1   +5%         +5%
BM_StreamingPingPongWithCoalescingApi<MinInProcess, NoOpMutator, NoOpMutator>/32k/2/0   +5%         +5%
BM_UnaryPingPong<InProcess, NoOpMutator, NoOpMutator>/0/32k                             +5%         +6%
BM_UnaryPingPong<InProcess, NoOpMutator, NoOpMutator>/32k/0                             +4%         +4%
BM_UnaryPingPong<MinInProcess, NoOpMutator, NoOpMutator>/32k/0                          +10%        +11%
BM_UnaryPingPong<MinInProcessCHTTP2, NoOpMutator, NoOpMutator>/32k/32k                  +4%

* Note: setting HAVE_CLOCK_GETTIME_MONOTONIC causes use of the clock_gettime
* function from glibc, don't set it to support glibc < 2.17 */
#ifndef GPR_BACKWARDS_COMPATIBILITY_MODE
#define HAVE_CLOCK_GETTIME_MONOTONIC 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to preserve this manual edit. HAVE_CLOCK_GETTIME_MONOTONIC being defined forces a dependency on glibc 1.17+ - it should break a couple of ruby distrib tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

#endif

#ifdef GPR_BACKWARDS_COMPATIBILITY_MODE
/* Redefine the fd_set macros for GLIBC < 2.15 support.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, I think we also need to preserve this manual edit. Building against latest FD_SET macros forces the binary dependency on glibc1.5+ (a couple of ruby distrib tests should also fail on this, #11346 for context)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@jtattermusch
Copy link
Copy Markdown
Contributor Author

@apolcyn, how was the ares_config.h for macos generated? I generated one one my gMac, but I'm getting a build error:

mkdir -p `dirname /jenkins/workspace/gRPC_pull_requests_macos/workspace_c_macos_dbg_native/objs/dbg/third_party/cares/cares/ares__timeval.o`
cc -Ithird_party/protobuf/src -Ithird_party/googletest/googletest/include -Ithird_party/googletest/googlemock/include -Ithird_party/boringssl/include -Ithird_party/cares -Ithird_party/cares/cares -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -DOSATOMIC_USE_INLINED=1 -O0 -fPIC -I. -Iinclude -I/jenkins/workspace/gRPC_pull_requests_macos/workspace_c_macos_dbg_native/gens -I/opt/local/include -I/usr/local/include -D_DEBUG -DDEBUG -DINSTALL_PREFIX=\"/usr/local\" -DGRPC_TEST_SLOWDOWN_MACHINE_FACTOR=1.000000    -Ithird_party/cares -Ithird_party/cares/cares  -Ithird_party/cares/config_darwin -fvisibility=hidden -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DHAVE_CONFIG_H -std=c99 -Wsign-conversion -Wconversion -Wshadow -Wextra-semi   -Wno-sign-conversion -Wno-shorten-64-to-32 -Wno-invalid-source-encoding -MMD -MF /jenkins/workspace/gRPC_pull_requests_macos/workspace_c_macos_dbg_native/objs/dbg/third_party/cares/cares/ares__read_line.dep -c -o /jenkins/workspace/gRPC_pull_requests_macos/workspace_c_macos_dbg_native/objs/dbg/third_party/cares/cares/ares__read_line.o third_party/cares/cares/ares__read_line.c
cc -Ithird_party/protobuf/src -Ithird_party/googletest/googletest/include -Ithird_party/googletest/googlemock/include -Ithird_party/boringssl/include -Ithird_party/cares -Ithird_party/cares/cares -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -DOSATOMIC_USE_INLINED=1 -O0 -fPIC -I. -Iinclude -I/jenkins/workspace/gRPC_pull_requests_macos/workspace_c_macos_dbg_native/gens -I/opt/local/include -I/usr/local/include -D_DEBUG -DDEBUG -DINSTALL_PREFIX=\"/usr/local\" -DGRPC_TEST_SLOWDOWN_MACHINE_FACTOR=1.000000    -Ithird_party/cares -Ithird_party/cares/cares  -Ithird_party/cares/config_darwin -fvisibility=hidden -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DHAVE_CONFIG_H -std=c99 -Wsign-conversion -Wconversion -Wshadow -Wextra-semi   -Wno-sign-conversion -Wno-shorten-64-to-32 -Wno-invalid-source-encoding -MMD -MF /jenkins/workspace/gRPC_pull_requests_macos/workspace_c_macos_dbg_native/objs/dbg/third_party/cares/cares/ares__timeval.dep -c -o /jenkins/workspace/gRPC_pull_requests_macos/workspace_c_macos_dbg_native/objs/dbg/third_party/cares/cares/ares__timeval.o third_party/cares/cares/ares__timeval.c
third_party/cares/cares/ares__timeval.c:48:11: error: implicit declaration of function 'clock_gettime' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  if(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) {
          ^
[C]       Compiling third_party/cares/cares/ares_cancel.c
third_party/cares/cares/ares__timeval.c:48:25: error: use of undeclared identifier 'CLOCK_MONOTONIC'
  if(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) {
                        ^
2 errors generated.
mkdir -p `dirname /jenkins/workspace/gRPC_pull_requests_macos/workspace_c_macos_dbg_native/objs/dbg/third_party/cares/cares/ares_cancel.o`
make: *** [/jenkins/workspace/gRPC_pull_requests_macos/workspace_c_macos_dbg_native/objs/dbg/third_party/cares/cares/ares__timeval.o] Error 1
make: *** Waiting for unfinished jobs....
cc -Ithird_party/protobuf/src -Ithird_party/googletest/googletest/include -Ithird_party/googletest/googlemock/include -Ithird_party/boringssl/include -Ithird_party/cares -Ithird_party/cares/cares -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -DOSATOMIC_USE_INLINED=1 -O0 -fPIC -I. -Iinclude -I/jenkins/workspace/gRPC_pull_requests_macos/workspace_c_macos_dbg_native/gens -I/opt/local/include -I/usr/local/include -D_DEBUG -DDEBUG -DINSTALL_PREFIX=\"/usr/local\" -DGRPC_TEST_SLOWDOWN_MACHINE_FACTOR=1.000000    -Ithird_party/cares -Ithird_party/cares/cares  -Ithird_party/cares/config_darwin -fvisibility=hidden -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DHAVE_CONFIG_H -std=c99 -Wsign-conversion -Wconversion -Wshadow -Wextra-semi   -Wno-sign-conversion -Wno-shorten-64-to-32 -Wno-invalid-source-encoding -MMD -MF /jenkins/workspace/gRPC_pull_requests_macos/workspace_c_macos_dbg_native/objs/dbg/third_party/cares/cares/ares_cancel.dep -c -o /jenkins/workspace/gRPC_pull_requests_macos/workspace_c_macos_dbg_native/objs/dbg/third_party/cares/cares/ares_cancel.o third_party/cares/cares/ares_cancel.c

2017-08-28 11:47:33,531 FAILED: make [ret=2, pid=11412]
2017-08-28 11:47:33,531 FAILED: Some tests failed

Also, any idea how to regenerate on freebsd?

@apolcyn
Copy link
Copy Markdown
Contributor

apolcyn commented Aug 29, 2017

I hadn't generated these header files before and am unsure off the top of my head. But I believe the current macos config_ares does also undefine HAVE_CLOCK_GETTIME_MONOTONIC https://github.com/grpc/grpc/blob/master/third_party/cares/config_darwin/ares_config.h#L73

@jtattermusch
Copy link
Copy Markdown
Contributor Author

@mehrdada it looks like config_freebsd/ares_config.h was added by you in #10724. How do I regenerate it?

@mehrdada
Copy link
Copy Markdown
Contributor

mehrdada commented Aug 29, 2017

@jtattermusch If I remember correctly, I tried running ./configure for c-ares on a FreeBSD machine and extracted the generated ares_config.h.

@mehrdada
Copy link
Copy Markdown
Contributor

@jtattermusch If you like, I can try generating a new one and push to your branch from a FreeBSD image?

@jtattermusch
Copy link
Copy Markdown
Contributor Author

jtattermusch commented Aug 29, 2017 via email

@grpc-kokoro
Copy link
Copy Markdown
Collaborator

[trickle] No significant performance differences

@mehrdada
Copy link
Copy Markdown
Contributor

mehrdada commented Aug 29, 2017

Done. Please merge this PR: jtattermusch#10

@grpc-kokoro
Copy link
Copy Markdown
Collaborator

[microbenchmarks] No significant performance differences

@mehrdada
Copy link
Copy Markdown
Contributor

mehrdada commented Aug 29, 2017

@y-zeng sorry I missed your comment above. I already regenerated it and @jtattermusch has merged. I have a FreeBSD machine at home, but just in case for future reference, you can create a GCE machine with a FreeBSD image with:

gcloud compute instances create "freebsd11-machine-name" \
--machine-type "n1-standard-8" \
--maintenance-policy "MIGRATE" \
--image "freebsd-11-0-release-p1-amd64" --image-project=freebsd-org-cloud-dev \
--boot-disk-size "40" --boot-disk-type "pd-ssd"

@grpc-kokoro
Copy link
Copy Markdown
Collaborator

[trickle] No significant performance differences

@grpc-kokoro
Copy link
Copy Markdown
Collaborator

[microbenchmarks] No significant performance differences

@y-zeng
Copy link
Copy Markdown
Contributor

y-zeng commented Aug 29, 2017

Thanks @mehrdada!
@jtattermusch Please run the Jenkins tests with GRPC_DNS_RESOLVER=ares to make sure the upgrade will not break the resolver.

@jtattermusch
Copy link
Copy Markdown
Contributor Author

Python 32 bit windows artifact compiled with mingw still broken:

In file included from third_party/cares/cares/ares_init.c:58:0:
third_party/cares/cares/ares_library_init.h:31:30: error: expected declaration specifiers or '...' before '*' token
 typedef NETIO_STATUS (WINAPI *fpGetBestRoute2_t) ( NET_LUID *, NET_IFINDEX, const SOCKADDR_INET *, const SOCKADDR_INET *, ULONG, PMIB_IPFORWARD_ROW2, SOCKADDR_INET * );
                              ^
In file included from third_party/cares/cares/ares_init.c:58:0:
third_party/cares/cares/ares_library_init.h:38:8: error: unknown type name 'fpGetBestRoute2_t'
 extern fpGetBestRoute2_t ares_fpGetBestRoute2;
        ^~~~~~~~~~~~~~~~~
third_party/cares/cares/ares_init.c: In function 'getBestRouteMetric':
third_party/cares/cares/ares_init.c:1022:3: error: unknown type name 'MIB_IPFORWARD_ROW2'
   MIB_IPFORWARD_ROW2 row;
   ^~~~~~~~~~~~~~~~~~
third_party/cares/cares/ares_init.c:1025:6: error: called object 'ares_fpGetBestRoute2' is not a function or function pointer
      ares_fpGetBestRoute2(/* The interface to use.  The index is ignored since we are
      ^~~~~~~~~~~~~~~~~~~~
In file included from third_party/cares/cares/ares_init.c:58:0:
third_party/cares/cares/ares_library_init.h:38:26: note: declared here
 extern fpGetBestRoute2_t ares_fpGetBestRoute2;
                          ^~~~~~~~~~~~~~~~~~~~
third_party/cares/cares/ares_init.c:1042:12: error: request for member 'Metric' in something not a structure or union
      || row.Metric == (ULONG)-1
            ^
third_party/cares/cares/ares_init.c:1043:12: error: request for member 'Metric' in something not a structure or union
      || row.Metric > ((ULONG)-1) - interfaceMetric) {
            ^
third_party/cares/cares/ares_init.c:1054:13: error: request for member 'Metric' in something not a structure or union
   return row.Metric + interfaceMetric;
             ^
third_party/cares/cares/ares_init.c: In function 'get_SuffixList_Windows':
third_party/cares/cares/ares_init.c:1430:32: warning: passing argument 1 of 'next_suffix' from incompatible pointer type [-Wincompatible-pointer-types]
       while (len = next_suffix(&pp, len))
                                ^
third_party/cares/cares/ares_init.c:1347:15: note: expected 'const char **' but argument is of type 'char **'
 static size_t next_suffix(const char** list, const size_t advance)
               ^~~~~~~~~~~
third_party/cares/cares/ares_init.c:1430:7: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
       while (len = next_suffix(&pp, len))
       ^~~~~
third_party/cares/cares/ares_init.c: In function 'getBestRouteMetric':
third_party/cares/cares/ares_init.c:1055:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
C:\tools\msys64\mingw32\bin\gcc.exe -mdll -O -Wall -IC:\Python27_32bits\include -IC:\Python27_32bits\PC -c t:\tmp\tmpcumiuy\a.c -o t:\tmp\tmpcumiuy\a.o

@jtattermusch
Copy link
Copy Markdown
Contributor Author

@y-zeng what exactly do you mean by "GRPC_DNS_RESOLVER=ares to make sure the upgrade will not break the resolver."? We are currently not running those tests by default? That seems like a problem.

I can run tests with GRPC_DNS_RESOLVER=ares locally, but it sounds like a bad idea to only do it as a one-off instead of running them continuously.

@jtattermusch
Copy link
Copy Markdown
Contributor Author

@y-zeng ok, I see, the GRPC_DNS_RESOLVER=ares tests are being run as part of linux portability suite (and only runs as build_only on PR)

test_jobs += _generate_jobs(languages=['c', 'c++'],
.

@jtattermusch
Copy link
Copy Markdown
Contributor Author

@y-zeng I ran the GRPC_DNS_RESOLVER=ares tests for C and C++ locally (with --use_docker)
and I only got this one failure which seems unrelated:

2017-08-30 15:58:42,392 FAILED: bins/dbg/json_run_localhost --scenarios_json '{"scenarios": [{"name": "cpp_protobuf_async_client_unary_1channel_64wide_128Breq_8MBresp_insecure", "warmup_seconds": 0, "benchmark_seconds": 1, "num_servers": 1, "server_config": {"async_server_threads": 0, "channel_args": [{"str_value": "latency", "name": "grpc.optimization_target"}, {"int_value": 1, "name": "grpc.minimal_stack"}], "security_params": null, "threads_per_cq": 0, "server_type": "ASYNC_SERVER"}, "num_clients": 1, "client_config": {"security_params": null, "channel_args": [{"str_value": "latency", "name": "grpc.optimization_target"}, {"int_value": 1, "name": "grpc.minimal_stack"}], "async_client_threads": 1, "outstanding_rpcs_per_channel": 1, "rpc_type": "UNARY", "payload_config": {"simple_params": {"resp_size": 8388608, "req_size": 128}}, "client_channels": 1, "threads_per_cq": 0, "load_params": {"closed_loop": {}}, "client_type": "ASYNC_CLIENT", "histogram_params": {"max_possible": 60000000000.0, "resolution": 0.01}}}]}' GRPC_POLL_STRATEGY=epoll1

I still need to fix the Python 32-bit artifact build on Windows, but after that, this PR should be good to go.

@apolcyn
Copy link
Copy Markdown
Contributor

apolcyn commented Aug 30, 2017

I ran this locally with not-checked-in-tests from PR #12210 and can confirm this doesn't break those

@jtattermusch
Copy link
Copy Markdown
Contributor Author

@grpc-kokoro
Copy link
Copy Markdown
Collaborator

[trickle] No significant performance differences

@grpc-kokoro
Copy link
Copy Markdown
Collaborator

[microbenchmarks] Performance differences noted:
Benchmark                                                                                     atm_cas_per_iteration    cpu_time    real_time
--------------------------------------------------------------------------------------------  -----------------------  ----------  -----------
BM_PumpStreamServerToClient<InProcess>/256k                                                   +5%
BM_PumpStreamServerToClient<InProcess>/32k                                                                             -15%        -14%
BM_StreamingPingPong<InProcess, NoOpMutator, NoOpMutator>/32k/2                                                        +12%        +13%
BM_StreamingPingPongMsgs<InProcess, NoOpMutator, NoOpMutator>/256k                                                     +7%         +7%
BM_StreamingPingPongMsgs<InProcess, NoOpMutator, NoOpMutator>/32k                                                      +11%        +10%
BM_StreamingPingPongMsgs<MinInProcess, NoOpMutator, NoOpMutator>/32k                                                   +5%         +5%
BM_StreamingPingPongWithCoalescingApi<InProcess, NoOpMutator, NoOpMutator>/32k/2/0                                     +13%        +13%
BM_StreamingPingPongWithCoalescingApi<MinInProcess, NoOpMutator, NoOpMutator>/32k/1/1                                  +8%         +8%
BM_StreamingPingPongWithCoalescingApi<MinInProcess, NoOpMutator, NoOpMutator>/32k/2/1                                  +7%         +8%
BM_StreamingPingPongWithCoalescingApi<MinInProcessCHTTP2, NoOpMutator, NoOpMutator>/256k/1/1                           +5%         +5%
BM_StreamingPingPongWithCoalescingApi<MinInProcessCHTTP2, NoOpMutator, NoOpMutator>/32k/1/0                            +4%         +4%

@grpc-kokoro
Copy link
Copy Markdown
Collaborator

[trickle] No significant performance differences

@grpc-kokoro
Copy link
Copy Markdown
Collaborator

[microbenchmarks] No significant performance differences

@jtattermusch jtattermusch merged commit c7520d0 into grpc:master Sep 10, 2017
This was referenced Nov 16, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants