quiche:remove setThreadFactory() from QuicThreadImpl#6700
quiche:remove setThreadFactory() from QuicThreadImpl#6700mattklein123 merged 10 commits intoenvoyproxy:masterfrom
Conversation
Signed-off-by: Dan Zhang <danzh@google.com>
|
/assign @mattklein123 @wu-bin |
wu-bin
left a comment
There was a problem hiding this comment.
Did you forget to commit quic_thread_impl.cc?
Signed-off-by: Dan Zhang <danzh@google.com>
Yes, sorry for missing it. |
mattklein123
left a comment
There was a problem hiding this comment.
Thanks for the fix, 1 question:
/wait-any
| #include "exe/platform_impl.h" | ||
|
|
||
| Envoy::Thread::ThreadFactory* getThreadFactory() { | ||
| static Envoy::PlatformImpl* platform_impl = new Envoy::PlatformImpl(); |
There was a problem hiding this comment.
cc @jmarantz I haven't been tracking the entire convo here, but don't we want to avoid potentially having multiple platform instances in the process? I thought we were considering some type of init() function that the QUICHE platform layer could use to then store static references if needed?
There was a problem hiding this comment.
This is test-only code, right? Can it be moved to test/extensions/quic_listeners/quiche/platform along with all the other code that depends on it?
Then you can just use Thread::threadFactoryForTest() which is defined in test/test_common/thread_factory_for_test.h
There was a problem hiding this comment.
Yes, I moved it to /test.
There was a problem hiding this comment.
cc @jmarantz I haven't been tracking the entire convo here, but don't we want to avoid potentially having multiple platform instances in the process? I thought we were considering some type of
init()function that the QUICHE platform layer could use to then store static references if needed?
Where to inject such init() function then? QUICHE has its own self-sufficient tests. The only place I could think of is overload testing::main, but not sure how much plumbing it would require.
There was a problem hiding this comment.
My thinking after that last discussion on #6658 was that no init() is necessary as Quic only needs singleton access to the ThreadFactory in tests, and we already have a mechanism for that.
There was a problem hiding this comment.
If it's just tests, we can do what @jmarantz proposes. If it's in production code, I think an initialize function called from main after the platform is ready should be fine?
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
jmarantz
left a comment
There was a problem hiding this comment.
basically looks good modulo one nit.
| public: | ||
| QuicThreadImpl(const std::string& /*name*/) {} | ||
| QuicThreadImpl(const std::string& /*name*/) { | ||
| thread_factory_ = &Envoy::Thread::threadFactoryForTest(); |
There was a problem hiding this comment.
make thread_factory_ a reference and init in the initializer, per Envoy convention.
There was a problem hiding this comment.
I refreshed a few times but this still doesn't look done to me; maybe this a github glitch?
There was a problem hiding this comment.
I made the change in the wrong branch. Now done in real.
bazel/external/quiche.BUILD
Outdated
|
|
||
| cc_library( | ||
| name = "quic_platform_port_utils", | ||
| name = "quic_platform_for_test", |
There was a problem hiding this comment.
This change is incompatible with my #6693. Can you add a new library instead?
There was a problem hiding this comment.
To clarify: QuicThread is test-only, but quic_port_utils.h is used in production so we need to split them, right? SGTM.
There was a problem hiding this comment.
quic_port_utils.h is also test-only, the problem is that I'm trying to use smaller libraries in #6693 and this PR is doing the opposite:)
There was a problem hiding this comment.
Should we just make sure that goes in first then?
There was a problem hiding this comment.
@jmarantz: Yes, I'd prefer for that to go in first:) I just assigned it to you:)
There was a problem hiding this comment.
Split into small libraries. This PR is blocking #6650. I hope to check in this one ASAP.
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
|
sync'ed with #6693. PTAL |
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com> Signed-off-by: Jeff Piazza <jeffpiazza@google.com>
QuicThreadImpl is initialized within QUIC tests defined in QUICHE, it doesn't call upon setThreadFactory() added by #6658 while creating thread. This PR makes QuicThreadImpl itself to provide a 'singleton' Envoy::PlatformImpl instance so that the interface of QuicThreadImpl can be as desired by QUICHE.
Risk Level: low, not in use
Testing: covered by existing test
Part of #2557