-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mobile: Replace std::thread with Envoy::Thread::PosixThread #32610
Conversation
2c7068d
to
4e56de8
Compare
/retest |
/assign @abeyad @alyssawilk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is awesome, thanks @fredyw !
...test/common/extensions/cert_validator/platform_bridge/platform_bridge_cert_validator_test.cc
Outdated
Show resolved
Hide resolved
adding @danzh2010 since she wrote the original code (I think), in case she has any concerns |
...le/library/common/extensions/cert_validator/platform_bridge/platform_bridge_cert_validator.h
Outdated
Show resolved
Hide resolved
Can you elaborate it? Envoy::Thread::Thread is just an interface and I assume PosixThread is an implementation of it. |
Signed-off-by: Fredy Wijaya <[email protected]>
Signed-off-by: Fredy Wijaya <[email protected]>
Signed-off-by: Fredy Wijaya <[email protected]>
Signed-off-by: Fredy Wijaya <[email protected]>
Signed-off-by: Fredy Wijaya <[email protected]>
Signed-off-by: Fredy Wijaya <[email protected]>
Signed-off-by: Fredy Wijaya <[email protected]>
Signed-off-by: Fredy Wijaya <[email protected]>
This PR is ready for another review. PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome, thanks @fredyw !
...e/library/common/extensions/cert_validator/platform_bridge/platform_bridge_cert_validator.cc
Outdated
Show resolved
Hide resolved
...le/library/common/extensions/cert_validator/platform_bridge/platform_bridge_cert_validator.h
Show resolved
Hide resolved
Signed-off-by: Fredy Wijaya <[email protected]>
Signed-off-by: Fredy Wijaya <[email protected]>
Signed-off-by: Fredy Wijaya <[email protected]>
Signed-off-by: Fredy Wijaya <[email protected]>
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two thoughts for now - mostly trusting Ali on E-M changes
/wait
Signed-off-by: Fredy Wijaya <[email protected]>
...le/library/common/extensions/cert_validator/platform_bridge/platform_bridge_cert_validator.h
Show resolved
Hide resolved
Signed-off-by: Fredy Wijaya <[email protected]>
Signed-off-by: Fredy Wijaya <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Envoy changes LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm mobile
no relevant owners for "mobile" |
added @lizan for cross company review |
Actually, per the new policy, this doesn't need cross company review: https://github.com/envoyproxy/envoy/pull/30995/files So I'm merging |
* origin: (34 commits) update CODEOWNER (envoyproxy#32457) Delete unused runtime flag. (envoyproxy#32739) mobile: Use direct ByteBuffer to pass data between C++ and Java (envoyproxy#32715) quic: support cert selection by SNI, non-PEM formats (envoyproxy#32260) mobile: Replace std::thread with Envoy::Thread::PosixThread (envoyproxy#32610) grpc: Add support for max frame length in gPRC frame decoding (envoyproxy#32511) build(deps): bump google.golang.org/protobuf from 1.32.0 to 1.33.0 (envoyproxy#32728) build(deps): bump the examples-golang-network group in /examples/golang-network/simple with 1 update (envoyproxy#32732) build(deps): bump google.golang.org/protobuf from 1.32.0 to 1.33.0 in /contrib/golang/filters/http/test/test_data/property (envoyproxy#32731) build(deps): bump otel/opentelemetry-collector from `246dfe9` to `71ac13c` in /examples/opentelemetry (envoyproxy#32730) build(deps): bump the examples-grpc-bridge group in /examples/grpc-bridge/server with 2 updates (envoyproxy#32720) build(deps): bump the contrib-golang group in /contrib/golang/router/cluster_specifier/test/test_data/simple with 1 update (envoyproxy#32721) build(deps): bump the contrib-golang group in /contrib/golang/filters/http/test/test_data/echo with 1 update (envoyproxy#32722) build(deps): bump the examples-ext-authz group in /examples/ext_authz/auth/grpc-service with 1 update (envoyproxy#32723) build(deps): bump the contrib-golang group in /contrib/golang/filters/http/test/test_data/routeconfig with 1 update (envoyproxy#32724) build(deps): bump the examples-load-reporting group in /examples/load-reporting-service with 1 update (envoyproxy#32726) build(deps): bump the contrib-golang group in /contrib/golang/filters/http/test/test_data/buffer with 1 update (envoyproxy#32727) build(deps): bump the examples-golang-http group in /examples/golang-http/simple with 1 update (envoyproxy#32729) opentelemetrytracer: Add User-Agent header to OTLP trace exporters (envoyproxy#32659) build: remove incorrect cc_library after tls code move (envoyproxy#32714) ...
This PR replaces the use of
std::thread
withEnvoy::Thread::PosixThread
(backed bypthread
). The reason for this change is becausestd::thread
may throw an exception and when exceptions are disabled, it will crash the program. For some certain code, such as the cert validation, it should not crash the program when a thread cannot be created, but it should return an error instead.This PR also refactors the POSIX thread wrapper implementation and exposes the APIs via
Envoy::Thread::PosixThreadFactory
andEnvoy::Thread::PosixThread
so that they can be used directly by Envoy Mobile since Envoy Mobile only supports Android and iOS and those OSes support POSIX. TheEnvoy::Thread::PosixThread
has additional functions not available inEnvoy::Thread::Thread
, such aspthreadId()
andjoinable()
to make the migration fromstd::thread
toEnvoy::Thread::PosixThread
easier. TheEnvoy::PosixThread::pthreadId()
is especially useful for doing a comparison withEnvoy::PosixThreadFactory::currentPthreadId()
.Risk Level: medium
Testing: unit tests
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: mobile