Commit Graph

6555 Commits

Author SHA1 Message Date
Ashitha Santhosh 74d554a4f0
Check for unsupported connection headers. (#27072)
* Check for unsupported condition headers.
2021-08-30 22:34:45 -07:00
Tamir Duberstein 76e95f6afd
Generalize pthread TLS to any trivial type (#27009)
* Avoid copy constructor

```
src/core/lib/gpr/log_linux.cc:78:33: error: copying variable of type 'grpc_core::PthreadTlsImpl<long>' invokes deleted constructor
  static GPR_THREAD_LOCAL(long) tid = 0;
                                ^     ~
./src/core/lib/gpr/tls.h:64:3: note: 'PthreadTlsImpl' has been explicitly marked deleted here
  PthreadTlsImpl(const PthreadTlsImpl&) = delete;
  ^
1 error generated.
```

* Generalize pthread TLS to any trivial type

Use multiple pthread keys for types larger than a machine word.

Implement generic timer TLS optimization on all platforms.
2021-08-30 11:32:47 -07:00
yihuaz c66d2cc084
Allow access to Google API regional endpoints via Google Default Credentials (#27155)
* fix Google API regional endpoint access issues

* address 1st round of comments

* fix minor nits
2021-08-30 10:57:48 -07:00
Craig Tiller 1ce8bd7067
Observable primitive for promises (#27082)
* promise sequences

* Activities for promises

* Observable primitive - single writer/multiple reader

* Automated change: Fix sanity tests

* dedup some code

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-27 14:56:48 -07:00
Craig Tiller 12cd59426b
Latch synchronization primitive (#27080)
* promise sequences

* Activities for promises

* Latch synchronization primitive

* Wakeups between actors in the same activity

* Automated change: Fix sanity tests

* Automated change: Fix sanity tests

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-27 12:43:28 -07:00
Craig Tiller 764232fa13
Fixes for map (#27079)
* fixes for map

* fix bad merge

* Automated change: Fix sanity tests

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-26 14:34:00 -07:00
Craig Tiller f2f60f7716
Revert "Implement TraceFlag::Log (#26954)" (#27145)
This reverts commit 4d2b979b75.
2021-08-26 09:18:45 -07:00
Ta-Wei Tu ab57f03b30
Reland: Import binder transport tests (#27138)
* Import binder transport tests

* Fix copybara import errors

* Add testonly labels
2021-08-26 15:33:37 +08:00
Ashitha Santhosh 1ff1f8fd83
SDK authorization filter. (#26468)
* SDK authorization filter.
2021-08-25 21:00:35 -07:00
Craig Tiller 90c4a2a5eb
Revert "Import binder transport tests (#26970)" (#27126)
This reverts commit 006464c57d.
2021-08-25 09:56:22 -07:00
Ta-Wei Tu 006464c57d
Import binder transport tests (#26970)
This PR imports unit tests and end-to-end tests of binder transport from the internal repository. No further changes will be made to internal repository.
2021-08-25 17:56:35 +08:00
Craig Tiller 5cdaec9a4f
Promise Activities (#26921)
* promise sequences

* Activities for promises

* Automated change: Fix sanity tests

* review feedback

* review feedback

* review feedback

* review feedback

* review feedback

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-24 22:21:58 -07:00
Chuan Ren e2ba0d9c0b
[3PI] Validate external account credentials token urls (#26966)
* Validate token urls

* Update external_account_credentials.cc

* Update external_account_credentials.cc

* Remove regex

* Validate implicit flow

* Update credentials_test.cc

* Update google_default_credentials.cc

* Revert "Update credentials_test.cc"

This reverts commit c43e00de2b.

* Revert "Validate token urls"

* Add tests for grpc_google_default_credentials_create

* Update google_default_credentials.cc
2021-08-24 14:37:03 -07:00
AJ Heller 4d2b979b75
Implement TraceFlag::Log (#26954)
Motivation: In debug builds, `DebugOnlyTraceFlag`s are hard-coded to be
disabled. This results in unreachable code paths that the compiler can
detect, which prevent us from enabling `-Wunreachable-code-aggressive`
on the builds.

This work aims to reduce the number of places that switch on
`trace_flag.enabled`.
2021-08-24 09:42:09 -07:00
Craig Tiller 6a06f0cd4a
promise sequences (#27058) 2021-08-23 17:39:12 -07:00
Craig Tiller 46afdf9989
Add test and mitigation for clang 11 compiler bug (#27073)
* Add test and mitigation for clang 11 compiler bug

* document

* document

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-22 22:35:51 -07:00
Craig Tiller f292f001ee
Promise join combinator (#26918)
* Add construct/destruct helper functions

Will be used in upcoming promise implementation

* Poll type for promises library

* Library to talk about things that look like promises if you squint

* Helper code for promises to deal with status types generically

* Library to talk about things that make promises

* build

* Join combinator for promise library

* Changes to sync required for promise activities

* sanitized

* Automated change: Fix sanity tests

* Automated change: Fix sanity tests

* Update basic_join.h

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-19 21:06:38 -07:00
Craig Tiller 59da7bc42a
Eliminate grpc_core::Atomic (#27025)
* Eliminate grpc_core::Atomic

* Automated change: Fix sanity tests

* Automated change: Fix sanity tests

* initialize things

* fix include order

* fix

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
Co-authored-by: Mark D. Roth <roth@google.com>
2021-08-19 20:54:55 -07:00
AJ Heller d10617edb5
Move resource_user ownership into chttp2 transport/server/connector v2 (#27032)
Reintroducing PR #26643, which was reverted in #27029

Fixed a memory leak and added a test that would have caught it (ASAN build): ca0c8c4
2021-08-18 17:04:00 -07:00
AJ Heller 46547d5690
Fix incorrect loop variable type (#27055)
The iterator returns a newly-constructed `std::pair<absl::string_view, absl::string_view>`.
Compiled with `-Wrange-loop-bind-reference` on iOS due to new dependencies for
iOS tests.
2021-08-18 14:33:28 -07:00
AJ Heller 4ba3fa52b9
Clean up some instances of -Wunreachable-code-aggressive (#27054)
See https://github.com/grpc/grpc/pull/26951 for why this is not enforced
at the moment.
2021-08-18 11:43:46 -07:00
Craig Tiller 724ad871d4
Promise loop (#26913)
* Poll type for promises library

* Library to talk about things that look like promises if you squint

* Library to talk about things that make promises

* Promises loop construct

* build

* Changes to sync required for promise activities

* sanitized

* add comments

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-18 10:36:14 -07:00
Craig Tiller aacd32c721
Promise library context management helpers (#26912)
* Promise library context management helpers

* Automated change: Fix sanity tests

* Automated change: Fix sanity tests

* fixes

* Automated change: Fix sanity tests

* missing file

* Automated change: Fix sanity tests

* compatibility

* build

* Automated change: Fix sanity tests

* propagate

* Automated change: Fix sanity tests

* merge with head

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-17 09:48:06 -07:00
Craig Tiller 4744aceb68
Promises race (#26915)
* Poll type for promises library

* Promises race construct

* Changes to sync required for promise activities

* Automated change: Fix sanity tests

* fix

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-17 09:27:40 -07:00
Craig Tiller cad2255d8c
First stab at config framework (#27014)
* First stab at config framework

* Automated change: Fix sanity tests

* add test for threaded initialization

* better test

* clang format

* better filenames

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-16 19:46:59 -07:00
Craig Tiller f5d3ed2db1
Revert "Move resource_user ownership into chttp2 transport/server/connector (#26643)" (#27029)
This reverts commit d1935a65a1. Will be rolled forward with a fix.
2021-08-16 19:07:39 -07:00
AJ Heller d1935a65a1
Move resource_user ownership into chttp2 transport/server/connector (#26643) 2021-08-16 13:50:56 -07:00
Craig Tiller 7ea742f3d5
Promise if construct (#26914)
* Poll type for promises library

* Library to talk about things that look like promises if you squint

* Library to talk about things that make promises

* Promises if construct

* build

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-16 12:08:38 -07:00
Craig Tiller 5dc93179eb
modernize % encoding routines (#27018)
* modernize % encoding routines

* Automated change: Fix sanity tests

* use bitset

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-16 11:16:18 -07:00
Craig Tiller 8ed20ae479
Promise map operator (#26917)
* Poll type for promises library

* Library to talk about things that look like promises if you squint

* Promise helpers, and basic type erasure

* Promise map operator - change return type via a function

* build

* Changes to sync required for promise activities

* sanitized

* Automated change: Fix sanity tests

* fixes

* fixes

* Automated change: Fix sanity tests

* fix build

* review feedback

* Automated change: Fix sanity tests

* comment

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-13 17:15:43 -07:00
Craig Tiller 152b79144c
Extract HPACK Encoder Hash Map to a separate file (#26973)
* comments

* Extract hash map from hpack encoder

* Automated change: Fix sanity tests

* x

* x

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-13 13:08:24 -07:00
Craig Tiller bbea27de46
Reland HPACK parsing changes (#26997)
* Revert "Revert "HPACK Table --> C++ (#26851)" (#26995)"

This reverts commit 840bcce9c4.

* fix bad parsing of trailing === in binary metadata
2021-08-13 10:57:42 -07:00
Tamir Duberstein 34338e5798
Avoid undefined behavior in pthread TLS (#26999)
See code commentary for an explanation.

Add an additional constructor to allow `log_linux.cc` to compile with
GPR_PTHREAD_TLS. Without it:

```
../../third_party/grpc/src/core/lib/gpr/log_linux.cc:78:33: error: no viable conversion from 'int' to 'grpc_core::PthreadTlsImpl<long>'
  static GPR_THREAD_LOCAL(long) tid = 0;
                                ^     ~
../../third_party/grpc/src/core/lib/gpr/tls.h:64:3: note: candidate constructor not viable: no known conversion from 'int' to 'const grpc_core::PthreadTlsImpl<long> &' for 1st argument
  PthreadTlsImpl(const PthreadTlsImpl&) = delete;
  ^
1 error generated.
```
2021-08-12 19:25:38 -07:00
Craig Tiller 71b2042c56
Promise factories (#26990)
* Poll type for promises library

* Library to talk about things that look like promises if you squint

* Library to talk about things that make promises

* build

* Changes to sync required for promise activities

* sanitized

* remove bad comment

* possible windows fix?

* fix

* ugh

* comment fix

* fix build

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-12 16:10:57 -07:00
Craig Tiller 840bcce9c4
Revert "HPACK Table --> C++ (#26851)" (#26995)
This reverts commit 83bcb0cf2e.
2021-08-12 11:20:19 -07:00
Craig Tiller 2e56b42ada
Generic promise facilities (#26916)
* Poll type for promises library

* Library to talk about things that look like promises if you squint

* Promise helpers, and basic type erasure

* build

* Changes to sync required for promise activities

* sanitized

* Automated change: Fix sanity tests

* suppressions

* try to fix windows failure

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-11 16:17:50 -07:00
Craig Tiller bb4311baed
Add a utility to capture arguments by move even in C++11 (#26923)
* Add a utility to capture arguments by move even in C++11

* add test

* Automated change: Fix sanity tests

* missing file

* Automated change: Fix sanity tests

* better test

* Automated change: Fix sanity tests

* fmt

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-11 15:31:22 -07:00
Tamir Duberstein 00c03c55ff
Implement type safety for TLS (#26942)
* Implement type safety for TLS

This is mostly free when compiler support is available, but requires
careful templating when implemented using pthread.

Significantly slimmed the tls.h interface; it now only defines the "TLS
keyword" for each supported compiler, delegating enforcement of correct
usage (i.e. must be static) to the compiler itself.

Implemented implicit conversion for the pthread wrapper so it can be
used (mostly) the same as native support. Notable exception to this is
that static_cast<void*> is needed when printing a pointer stored in TLS
as %p.

* Use GPR_THREAD_LOCAL macros consistently
2021-08-11 13:24:26 -07:00
Craig Tiller 83bcb0cf2e
HPACK Table --> C++ (#26851)
* Buffer HPACK parsing until the end of a header boundary

HTTP2 headers are sent in (potentially) many frames, but all must be
sent sequentially with no traffic intervening.

This was not clear when I wrote the HPACK parser, and still indeed quite
contentious on the HTTP2 mailing lists.

Now that matter is well settled (years ago!) take advantage of the fact
by delaying parsing until all bytes are available.

A future change will leverage this to avoid having to store and verify
partial parse state, completely eliminating indirect calls within the
parser.

* maybe fixes

* xx

* fix boundary detection

* clang-format

* Revert "xx"

This reverts commit 258d712ed3.

* fix tests

* add missed check

* fixes

* fix

* update tests

* fix benchmark

* properly unref

* optimize final slice refcounting

* cleanup bm_chttp2_hpack

* start

* new parser progress

* refinement

* get it compiling

* bug-fix

* build files

* clang-tidy

* fixes

* fixes

* fixes

* fix-leaks

* clang-tidy

* comments

* fix merge error

* Revert "Buffer HPACK parsing until the end of a header boundary (#26700)"

This reverts commit 8bab3e4bf4.

* streaming hpack parser start

* streaming parser

* clang-format

* Rework HPackTable into C++

* clang-tidy

* fix merge

* actually set the size of the entries array

* better
2021-08-09 16:07:41 -07:00
Yash Tibrewal cb2d13fa73
Fix BUILD file for //test/core/promise (#26949) 2021-08-09 12:07:51 -07:00
Craig Tiller 58d3161aac
Split the filter popularity counting into a separate module (#26884)
* split hpack encoder filter into a separate class

* chores

* fix

* Automated change: Fix sanity tests

* include guards

* add suppressions

* Update popularity_count_test.cc

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2021-08-09 10:16:46 -07:00
Yash Tibrewal 3e197acaa1
Limit initial window size increases and per-stream window delta (#26342)
* Limit initial window size increases/decreases by flow control windows of active streams

* Limit stream flow control window updates to maximum allowable

* Reviewer comments

* Alternative way

* Clean-up

* Add tests

* Remove unnecessary cq_verifier

* Generate projects

* Initialize recv_message

* Get around compilation issue

* Test size large
2021-08-09 09:05:28 -07:00
Craig Tiller 3d26032736
Poll type for promises library (#26907)
* Poll type for promises library

* sanitized

* suppressions

* Add a comment
2021-08-06 18:14:30 -07:00
Tamir Duberstein ccad567e0b
Disallow implicit fallthrough (#26874)
Most instances were already explicit through comments, so it's clear
that the author cared about being explicit; use the compiler to ensure
this is always the case.
2021-08-04 21:34:27 -07:00
Tamir Duberstein 013e67a029
Deprecate grpc{_core,::internal}::WaitUntil (#26866)
It is not possible for such a function to be implemented in a way that
is understood by annotalysis. Mark it deprecated and replace instances
of its use with direct mutex/condvar usage.

Add a bunch of missing thread safety annotations while I'm here.
2021-08-04 17:03:25 -07:00
Mark D. Roth 6b71ec3704
LB policy API improvements (#26481)
* LB policy API improvements

* clang-format

* fix build

* a bit more cleanup

* use absl::variant<> for pick result

* fix retry_lb_drop test

* clang-format

* fix grpclb_end2end_test

* fix xds_end2end_test

* try to make variant code a bit cleaner

* clang-format

* fix memory leak

* fix build

* clang-format

* fix error refcount bug

* remove PickResult factory functions

* clang-format

* add ctors to structs

* clang-format

* fix clang-tidy

* update comments

* move LB recv_trailing_metadata callback instead of copying it

* use Match() instead of providing PickResult::Handle()

* don't use Match() for now, since it breaks lock annotations

* update retry_lb_fail test
2021-08-03 09:43:07 -07:00
Mark D. Roth d140f14caf
Enable retries by default (#26766)
* Enable retries by default, but add a separate arg for hedging.

* don't need to explicitly enable retries in xDS config selector

* clang-format

* don't need retry_enabled bit anymore

* fix HTTP client filter to restore the send_message op in the batch

* fix retry cancellation when a batch fails on call attempt

* fix clang-tidy

* fix client channel to pass down batches even after cancellation

* fix retry code to pass transport stats back up to the surface

* add some missing payload propagation

* fix retry handling of callbacks for pending batches

* avoid scheduling the same callback twice

* fix some trace messages

* don't avoid starting recv_initial_metadata or recv_message due to recv_trailing_metadata already being started internally

* avoid restarting recv_trailing_metadata after commit if we've already started it internally

* use fast path when retries are not configured
2021-08-02 15:23:30 -07:00
Mark D. Roth fbd5e9f2ed
add separate channel arg to enable hedging (#26838)
* add separate channel arg to enable hedging

* revert change to retry_disabled test
2021-08-02 10:07:51 -07:00
Mark D. Roth c9149526a6
fix retry handling of callbacks for pending batches (#26803)
* fix retry handling of callbacks for pending batches

* avoid scheduling the same callback twice

* fix some trace messages

* don't avoid starting recv_initial_metadata or recv_message due to recv_trailing_metadata already being started internally

* avoid restarting recv_trailing_metadata after commit if we've already started it internally
2021-07-29 14:05:11 -07:00
Craig Tiller 613b90ba93
Revert "Buffer HPACK parsing until the end of a header boundary (#26700)" (#26825)
This reverts commit 8bab3e4bf4.
2021-07-29 11:22:47 -07:00