Commit Graph

1648 Commits

Author SHA1 Message Date
Richard Belleville 3bdd972c4a
[Release] Bump master version to 1.60 (gjallarhorn) (#34488)
<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
2023-09-26 13:10:20 -07:00
Stan Hu b3467cdab4
[ruby] Fix linking errors on x86-darwin (#34134)
https://github.com/grpc/grpc/pull/33538 added `-weak_framework
CoreFoundation` in `DLDFLAGS` for only `arm64-darwin` builds, but the
issue reported in https://github.com/grpc/grpc/issues/33483 can also
happen on `x86-darwin` builds. This can happen if:

1. The Ruby interpreter is compiled without
`-Wl,-undefined,dynamic_lookup`.
2. This happens if the Ruby interpreter is built with XCode 14.0 to 14.2
(https://bugs.ruby-lang.org/issues/19005).

Simplify the logic and always include `-weak_framework CoreFoundation`
for macOS builds.
2023-09-21 21:23:11 -07:00
alto-ruby dfa040f49f
[Ruby] replace strdup with gpr_strdup (#34177)
grpc 1.57.0 crashes win ruby and alpine due to no `strdup` in musl libc.
This diff replace `strdup` with `grp_strdup`

```
Thread 1 "ruby" received signal SIGSEGV, Segmentation fault.
0x00000000000a4596 in ?? ()
(gdb) bt
#0  0x00000000000a4596 in ?? ()
#1  0x00007ffff14e298c in grpc_rb_channel_create_in_process_add_args_hash_cb (key=<optimized out>, val=<optimized out>, args_obj=<optimized out>) at rb_channel_args.c:84
#2  0x00007ffff7c2b9ea in hash_ar_foreach_iter (error=0, argp=140737488344784, value=<optimized out>, key=<optimized out>) at hash.c:1341
```

fixes #34044
closes #27995
2023-09-19 11:56:18 -07:00
Esun Kim 1a1124903c
[Deps] Upgrade Protobuf and Upb to 24.x (#34123)
On top of https://github.com/grpc/grpc/pull/34120
2023-08-29 10:58:48 -07:00
Esun Kim a90f30008d
[Release] Bump version to 1.59.0-dev (on master branch) (#34144)
Change was created by the release automation script. See
go/grpc-release.
2023-08-23 15:53:32 -07:00
apolcyn 06d0a6c0fd
[ruby] improve handling for recv_message op failures (#34016)
[ruby] improve handling for recv_message op failures (don't assume recv_message ops won't fail e.g. if the call was cancelled by the peer)
2023-08-10 12:25:29 -07:00
alto-ruby f3419f8373
[Ruby] set metadata_sent after call success (#33998)
fixes #25373
2023-08-09 23:56:07 +00:00
alto-ruby b4a39a2230
[Ruby] add special status msg interop test (#33990)
fixes #24176

```
./tools/run_tests/run_interop_tests.py -l ruby -s c++ --use_docker
No module named 'apiclient'
Seen --use_docker flag, will run interop tests under docker.

IMPORTANT: The changes you are testing need to be locally committed
because only the committed changes in the current branch will be
copied to the docker environment.
START: Building interop docker images.
PASSED: build_docker_ruby [time=479.4sec, retries=0:0]
PASSED: build_docker_c++ [time=686.0sec, retries=0:0]
SUCCESS: All docker images built successfully.
START: interop_server_c++
PASSED: cloud_to_cloud:ruby:c++_server:cancel_after_begin:tls [time=0.9sec, retries=0:0]
PASSED: cloud_to_cloud:ruby:c++_server:empty_unary:tls [time=1.0sec, retries=0:0]
PASSED: cloud_to_cloud:ruby:c++_server:empty_stream:tls [time=1.0sec, retries=0:0]
PASSED: cloud_to_cloud:ruby:c++_server:cancel_after_first_response:tls [time=1.0sec, retries=0:0]
PASSED: cloud_to_cloud:ruby:c++_server🏓tls [time=1.0sec, retries=0:0]
PASSED: cloud_to_cloud:ruby:c++_server:server_streaming:tls [time=1.0sec, retries=0:0]
PASSED: cloud_to_cloud:ruby:c++_server:client_streaming:tls [time=1.0sec, retries=0:0]
PASSED: cloud_to_cloud:ruby:c++_server:large_unary:tls [time=1.0sec, retries=0:0]
PASSED: cloud_to_cloud:ruby:c++_server:status_code_and_message:tls [time=0.8sec, retries=0:0]
PASSED: cloud_to_cloud:ruby:c++_server:unimplemented_method:tls [time=0.8sec, retries=0:0]
PASSED: cloud_to_cloud:ruby:c++_server:custom_metadata:tls [time=0.9sec, retries=0:0]
PASSED: cloud_to_cloud:ruby:c++_server:unimplemented_service:tls [time=0.8sec, retries=0:0]
PASSED: cloud_to_cloud:ruby:c++_server:client_compressed_streaming:tls [time=0.8sec, retries=0:0]
PASSED: cloud_to_cloud:ruby:c++_server:special_status_message:tls [time=0.8sec, retries=0:0]
PASSED: cloud_to_cloud:ruby:c++_server:client_compressed_unary:tls [time=0.8sec, retries=0:0]
PASSED: cloud_to_cloud:ruby:c++_server:timeout_on_sleeping_server:tls [time=1.8sec, retries=0:0]
SUCCESS: All tests passed
```
2023-08-09 16:52:39 -07:00
apolcyn 7c21997dba
[ruby] remove unnecessary background thread startup wait logic that interferes with forking (#33805)
Alternative to https://github.com/grpc/grpc/pull/33804 - this takes the
approach in
https://github.com/grpc/grpc/pull/33804#issuecomment-1645792677

Fix https://github.com/grpc/grpc/issues/33802

cc @casperisfine
2023-07-24 15:17:54 -07:00
AJ Heller 42b0d01e68
[Release] Bump version to 1.58.0-dev (on master branch) (#33825)
Change was created by the release automation script. See go/grpc-release
2023-07-24 10:09:08 -07:00
apolcyn 3d9f2d8f77
[ruby] improve possible error message in postfork parent (#33791)
The case of `!grpc_ruby_initial_pid()` can be a *cause* of the second
case, `!grpc_ruby_initial_thread`, so check the pid first.
2023-07-20 13:47:13 -07:00
apolcyn d4cbb7a96d
[ruby] fix crash when prefork/postfork is used without previously using grpc (#33788)
Should fix https://github.com/grpc/grpc/issues/33787
2023-07-20 11:26:02 -07:00
apolcyn a28900a9cf
[ruby] raise RPC deadline in a flakey test (#33713)
As title - use a deadline that rules out starvation as a source of
flakiness
2023-07-20 10:07:24 -07:00
alto-ruby 75ecd170f8
[Ruby] remove manual strip in ruby ext conf (#33641)
Custom strip invalidates the signature, caused the arm64-darwin gem
failed to run on M1 macs.
Error in mac console: `Exception Type: EXC_BAD_ACCESS (SIGKILL (Code
Signature Invalid))`

Warning in gem build log:
```
# linking shared-object grpc/grpc_c.bundle
# Stripping grpc_c.bundle
# /opt/osxcross/target/bin/aarch64-apple-darwin20.2-strip: warning: changes being made to the file will invalidate the code signature in: /Users/jeff/work/ruby/grpc/tmp/arm64-darwin/grpc_c/3.2.0/grpc_c.bundle
```

Custom stripping is not really needed (any more), this diff removes it
from `src/ruby/ext/grpc/extconf.rb`, the [gem
artifact](https://console.cloud.google.com/storage/browser/grpc-testing-kokoro-prod/test_result_public/prod/grpc/core/pull_request/linux/grpc_distribtests_ruby/19833/20230708-181642/github/grpc/artifacts?pageState=(%22StorageObjectListTable%22:(%22f%22:%22%255B%255D%22))&prefix=&forceOnObjectsSortingFiltering=false)
size didn't change and arm64-darwin gem runs fine on M1 mac.

fixes: #28631
fixes: #29100
2023-07-17 16:57:45 -07:00
AJ Heller c81bdf7a83
[Protobuf] Upgrade third_party/protobuf to 23.4 (#33695)
This was done manually due to a problem with
`tools/distrib/python/make_grpcio_tools.py`. ~I fixed it in this PR
(depends on cl/547979185), so there is a fair chance this upgrade will
work normally for the next release.~ The fix may be problematic for
upgrading protobuf on older release branches, so the improvement will be
worked on separately. CC @jtattermusch

This also updates the UPB dep to the latest commit on the 23.x branch.
2023-07-14 12:04:40 -07:00
apolcyn b21152269d
[ruby] simplify shutdown; remove unnecessary attempts at grpc_shutdown (#33674)
So far, we've structured global C-core init/shutdown as follows:
1) every grpc-ruby object calls `grpc_init` when allocated, and
`grpc_shutdown` when finalized
2) grpc-ruby background threads are each wrapped in a
`grpc_init/shutdown` pair - for example see
b32d94de05/src/ruby/ext/grpc/rb_event_thread.c (L122)
and
b32d94de05/src/ruby/ext/grpc/rb_event_thread.c (L136)

But because ruby doesn't join ruby threads when the process is
terminating, the `init/shutdown` pairs in 2) are always left open. I.e.,
thus far we have never been invoking the final call to `grpc_shutdown`
which actually does C-core global shutdown. Thus our calls to
`grpc_shutdown` are useless.

So we might as well keep things simple and not even attempt to call
`grpc_shutdown`. Now we just call `grpc_init` before using C-core, and
then never even attempt global shutdown (in non-forking situations).

As a bonus, this fixes the issue with the event thread's
`grpc_ruby_init` racing with `prefork` that is mentioned in
https://github.com/grpc/grpc/pull/33666
2023-07-12 15:50:33 -07:00
apolcyn fe11ec9bcb
[ruby] experimental client side fork support (#33430)
Adds experimental fork support to gRPC/Ruby

Works towards https://github.com/grpc/grpc/issues/8798 (see caveats for why this wasn't marked fixed yet)
Works towards https://github.com/grpc/grpc/issues/33578 (see caveats for why this wasn't marked fixed yet)

This leverages existing `pthread_atfork` based C-core support for
forking that python/php use, but there's a bit extra involved mainly
because gRPC/Ruby has additional background threads.

New tests under `src/ruby/end2end` show example usage.

Based on https://github.com/grpc/grpc/pull/33495

Caveats:
- Bidi streams are not yet supported (bidi streams spawn background
threads which are not yet fork safe)
- Servers not supported
- Only linux supported
2023-07-10 13:34:10 -07:00
alto-ruby f7b1ed8287
[Ruby] remove objs and strip libs in ruby extension build (#33596)
Remove `src/ruby/ext/grpc/objs/` and strip `src/ruby/ext/grpc/libs/` in
ruby build dir to save some space.
This can reduce the grpc gem size from more than 1G to about 70~80M.
This only affects opt build, dbg build remains the same.

A proper fix maybe use the same makefile to build c-core and the
extension rather than building c-core when generating the extension
makefile.

fixes: https://github.com/grpc/grpc/issues/33412
2023-07-09 18:38:53 -07:00
Matthew Stevenson 278978d6f0
[tls] Remove use of SSL_CTX_set_client_CA_list for TLS server credentials. (#33558)
This PR does the following: for the TLS server credentials, stops
calling `SSL_CTX_set_client_CA_list` by default in
`ssl_transport_security.cc`, and gives users a knob to re-enable calling
this API.

## What does the `SSL_CTX_set_client_CA_list` API do?

When this API is called, a gRPC TLS server sends the following data in
the ServerHello: for each certificate in the server's trust bundle, the
CA name in the certificate.

This API does not change the set of certificates trusted by the server
in any way. Rather, it is just providing a hint to the client about what
client certificate should be sent to the server.

## Why are we removing the use of `SSL_CTX_set_client_CA_list` by
default for the TLS server credentials?

Removing the use of this API by default has 2 benefits:
1. Calling this API makes gRPC TLS unusable for servers with a
sufficiently large trust bundle. Indeed, if the server trust bundle is
too large, then the server will always fail to build the ServerHello.
2. Calling this API is introducing a huge amount of overhead (1000s of
bytes) to each ServerHello, so removing this feature will improve
connection establishment latency for all users of the TLS server
credentials.
2023-06-29 09:48:15 -07:00
Mike Dalessio 6076825390
[ruby] Add `-weak_framework CoreFoundation` to link line (#33538)
Add -weak_framework CoreFoundation to the ruby extension link line on
arm64-darwin, to address "undefined symbols" issues from #33483

This is a variation on #33513 in response to feedback and so I've made
sure @alto-ruby is credited as co-author.

Closes #33483

Supersedes #33513

cc @apolcyn

Co-authored-by: alto-ruby <altorubys@gmail.com>
2023-06-23 15:43:02 -07:00
Peter Zhu a4ab4d0033
[Ruby] Fix memory leak in grpc_rb_call_run_batch (#33368)
The function grpc_rb_call_run_batch has many places that could raise
errors, including in child functions. Since a raised error will longjump
out of the function, it will cause memory leaks since the function
cannot perform any clean up. This commit fixes the issue by wrapping the
whole function in an rb_ensure, which will ensure that a cleanup
function is ran before the error is propagated upwards.
2023-06-09 14:30:23 -07:00
Peter Zhu 4fd6dc2066
[Ruby] Fix memory leak in grpc_rb_server_request_call (#33371)
The function grpc_rb_server_request_call has many places that could
raise errors, including in child functions. Since a raised error will
longjump out of the function, it will cause memory leaks since the
function cannot perform any clean up. This commit fixes the issue by
wrapping the whole function in an rb_ensure, which will ensure that a
cleanup function is ran before the error is propagated upwards.
2023-06-09 14:30:05 -07:00
Yijie Ma 5a0678001b
[Release] Bump version to 1.57.0-dev (on master branch) (#33311)
Change was created by the release automation script. See
go/grpc-release.
2023-06-01 10:55:31 -07:00
Stan Hu 01c87e24da
[ruby] fix re2 compilation when older system version installed (#32580)
re2 previously failed to compile if:

1. An old `re2` version is installed with a non-standard system prefix,
such as `/opt/local`.
2. The environment variable is set: `CPPFLAGS=-I/opt/local/include`.

Running `make` would result in function prototype mismatches because the
Makefile would previously attempt to use the headers from
`/opt/local/include/re2` before the `third_party/re2/re2` directory.

https://github.com/grpc/grpc/pull/27660 caused `CPPFLAGS` to inherit
from the environment, but this can cause the Makefile to use external
include files for re2 and other libraries if `-I` flags are defined.

This commit reverts to the original behavior of only using
`RbConfig::CONFIG` values to avoid using the wrong headers.
2023-05-16 11:09:55 -07:00
Yash Tibrewal dc075539e7
[Release] Bump version to 1.56.0-dev (on master branch) (#32918)
Change was created by the release automation script. See go/grpc-release
2023-04-24 10:47:57 -07:00
y.okamoto 0ce39dca7e
[Ruby] Fixed the return value of `PLATFORM.architecture` when MacOS is Ventura ( #31782 ). (#31783)
i apologize if my PR is wrong. I'm not used to sending PRs. 🙇 

i fixed the bug(#31782).
please read this issue for more information.
2023-03-30 08:33:25 -07:00
Stanley Cheung ec1d75bb0a
[Release process] Bump version to 1.55.0-dev (on master branch) (#32743)
Change was created by the release automation script. See
go/grpc-release.
2023-03-29 11:03:07 -07:00
Mark D. Roth 50e6af14ff
Bump dev version to 1.54.0-dev (#32426) 2023-02-21 12:03:19 -08:00
apolcyn 4777db3003
[ruby testing]: experimental change to grpc_class_init_test (#32337)
Let's see if this fixes the "Bus error" flakes that have been happening
in CI.

If it does, then we can narrow things down a bit. If flakes continue,
then we can revert this PR.
2023-02-14 14:49:11 -08:00
apolcyn 8734964482
Simplify ruby class init test (#32307) 2023-02-07 10:39:03 -08:00
apolcyn c1a4b526fb
[ruby]: add pre-compiled binaries for ruby 3.2; drop them for ruby 2.6 (#32089)
[ruby]: add pre-compiled binaries for ruby 3.2; drop them for ruby 2.6
2023-01-19 15:32:26 -08:00
Jan Tattermusch 17cadf8689
Fix regenerate protos scripts. (#32135)
* src/proto/grpc/core/stats.proto no longer exists

* remove PHP generated file for proto that no longer exists

* run src/ruby/pb/generate_proto_ruby.sh
2023-01-19 09:16:23 +01:00
Jan Tattermusch 7fd808f6f9
Bump version to 1.53.0-dev (on master branch) (#32086)
* bump version to 1.53.0-dev

* regenerate projects
2023-01-18 09:41:33 +01:00
Craig Tiller 67f364e23e
[cleanup] Eliminate usage of GRPC_ASSERT(false...); (#31757)
* crash function

* progress

* fix

* fix

* Automated change: Fix sanity tests

* fix

* fix

* fix

* fixes

* Automated change: Fix sanity tests

* fix

* Automated change: Fix sanity tests

* fix

* fix

* use cpp attr

* Automated change: Fix sanity tests

* fix

* fix

* fix

* fix

* fix

* fix

* add exclusion

* fix

* typo

* fix

* fmt

* Update tcp_socket_utils.cc

* Automated change: Fix sanity tests

* fix

* revert php changes

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-01-11 08:50:32 -08:00
Adam Hess 8d5e0a71a6
remove default allocators (#30434)
In Ruby 3.2 the default allocator warns if used with `Data_Wrap_Struct`. This removed the default allocator in those cases.

Ruby discussion: https://bugs.ruby-lang.org/issues/18007
2023-01-05 18:09:18 -08:00
Stan Hu 06a9fbd382
Fix Ruby build errors in 3.2.0 on Apple M1 (#31997)
Previously attempting to build the Ruby C extensionwould result in
undefined symbol:

```
Undefined symbols for architecture arm64:
  "_ruby_abi_version", referenced from:
     -exported_symbol[s_list] command line option
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

As noted in https://github.com/ruby/ruby/pull/6231,
`_ruby_abi_version` is only available for development
versions. `RUBY_PATCHLEVEL` < 0 denotes a development version, while
>= 0 denotes a released version.
2023-01-04 16:27:44 -08:00
apolcyn e31cfaaa11
Update default ruby version to 3.2 on linux/macos ruby builds (#32010)
* Use ruby 3.2 in macos and linux ruby builds
2023-01-03 13:38:15 -08:00
apolcyn a2cf991f08
always export _rb_tr_abi_version on truffle ruby (#31995) 2022-12-29 13:44:58 -08:00
apolcyn 05c5083477
make exported symbol files platform specific (#31970) 2022-12-22 14:11:58 -08:00
Cheng-Yu Chung 9a7e77318b
[cleanups] Remove `include/grpc/impl/codegen/grpc_types.h` (#31835)
* Remove `include/grpc/impl/codegen/grpc_types.h`

* Automated change: Fix sanity tests

* Fix typo

* Automated change: Fix sanity tests
2022-12-14 02:29:17 +08:00
Cheng-Yu Chung 0d3fcb41ea
Revert "Move google_default channel_credentials out of `include/grpc/grpc_security.h` (#31786)" (#31822)
This reverts commit 3d59abc94e.
2022-12-06 11:39:43 -08:00
Cheng-Yu Chung 3d59abc94e
Move google_default channel_credentials out of `include/grpc/grpc_security.h` (#31786) 2022-12-06 10:59:57 +08:00
Cheng-Yu Chung dba82c9be6
Remove `include/grpc/impl/codegen/log.h` (#31775)
* Remove `include/grpc/impl/codegen/log.h`

* Automated change: Fix sanity tests
2022-12-05 20:51:35 +08:00
Cheng-Yu Chung 3d68bb735a
Remove `include/grpc/impl/codegen/byte_buffer.h` (#31674) 2022-11-17 15:50:03 -05:00
Craig Tiller d410f1d0aa
[surface] Ensure SEND_STATUS & RECV_MESSAGE do not inhabit the same batch (#31554)
Add a check that SEND_STATUS_FROM_SERVER and RECV_MESSAGE are not in the same batch.

This is necessary pre-work for #31204 and implements part of grpc/proposal#336.

Also eliminates fling instead of updating it:

My expectation is nobody has looked at this corner in many years
It's not a benchmark we want: concentrating on a microbenchmark that doesn't include a binding layer caused us to favor designs that emphasized a lightweight core at the expense of a expensive bindings. We should consider the whole.

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2022-11-11 14:18:29 -08:00
Richard Belleville 51f296b4f8
Bump master branch to 1.52.0-dev (gribkoff) (#31618)
* bump version to 1.52.0-dev

* regenerate projects
2022-11-10 16:11:08 -08:00
Esun Kim 42c2767c19
Revert "Bump v1.51.x to 1.51.0-pre1 (#31620)" (#31621)
This reverts commit bae9dd79aa.
2022-11-10 15:21:14 -08:00
Richard Belleville bae9dd79aa
Bump v1.51.x to 1.51.0-pre1 (#31620)
* bump version to 1.51.0-pre1

* regenerate projects
2022-11-10 15:17:59 -08:00
apolcyn 6f1dcffef8
ruby: fix a unit test to make sure it always terminates the RPC (#31494) 2022-10-31 10:59:46 -07:00
apolcyn 236953cb2f
ruby: remove tests that try to assert a certain behabior after forking (#31353)
incorrectly
2022-10-17 11:53:17 -07:00