-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Add quic_expect_bug_impl.h, (spdy|http2)_logging_impl.h, (spdy|http2)_bug_tracker_impl.h QUICHE platform implementation #6339
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
Changes from 4 commits
7d3314a
113f47c
9bf4b26
c338d2f
105d171
751d882
f9f7cde
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,14 +42,21 @@ envoy_cc_library( | |
| "http2_ptr_util_impl.h", | ||
| "http2_string_impl.h", | ||
| "http2_string_piece_impl.h", | ||
| ] + envoy_select_quiche(["http2_string_utils_impl.h"]), | ||
| ] + envoy_select_quiche([ | ||
| "http2_bug_tracker_impl.h", | ||
| "http2_logging_impl.h", | ||
| "http2_string_utils_impl.h", | ||
| ]), | ||
| external_deps = [ | ||
| "abseil_base", | ||
| "abseil_optional", | ||
| "abseil_str_format", | ||
| ], | ||
| visibility = ["//visibility:public"], | ||
| deps = envoy_select_quiche([":string_utils_lib"]), | ||
| deps = envoy_select_quiche([ | ||
| ":quic_platform_logging_impl_lib", | ||
| ":string_utils_lib", | ||
| ]), | ||
| ) | ||
|
|
||
| envoy_cc_library( | ||
|
|
@@ -58,9 +65,19 @@ envoy_cc_library( | |
| visibility = ["//visibility:public"], | ||
| ) | ||
|
|
||
| envoy_cc_library( | ||
| name = "quic_platform_logging_impl_lib", | ||
| srcs = ["quic_logging_impl.cc"], | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this need to be wrapped in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not necessary, libraries depend on this is using envoy_select_quiche. |
||
| hdrs = [ | ||
| "quic_bug_tracker_impl.h", | ||
| "quic_logging_impl.h", | ||
| ], | ||
| visibility = ["//visibility:public"], | ||
| deps = ["//source/common/common:assert_lib"], | ||
| ) | ||
|
|
||
| envoy_cc_library( | ||
| name = "quic_platform_base_impl_lib", | ||
| srcs = envoy_select_quiche(["quic_logging_impl.cc"]), | ||
| hdrs = [ | ||
| "quic_aligned_impl.h", | ||
| "quic_arraysize_impl.h", | ||
|
|
@@ -80,6 +97,7 @@ envoy_cc_library( | |
| "quic_string_piece_impl.h", | ||
| "quic_uint128_impl.h", | ||
| ] + envoy_select_quiche([ | ||
| "quic_expect_bug_impl.h", | ||
| "quic_logging_impl.h", | ||
| "quic_mock_log_impl.h", | ||
| "quic_stack_trace_impl.h", | ||
|
|
@@ -97,6 +115,7 @@ envoy_cc_library( | |
| ], | ||
| visibility = ["//visibility:public"], | ||
| deps = ["@com_googlesource_quiche//:quic_platform_export"] + envoy_select_quiche([ | ||
| ":quic_platform_logging_impl_lib", | ||
| "//include/envoy/thread:thread_interface", | ||
| "//source/common/common:assert_lib", | ||
| "//source/server:backtrace_lib", | ||
|
|
@@ -114,7 +133,6 @@ envoy_cc_library( | |
| "quic_mutex_impl.h", | ||
| "quic_str_cat_impl.h", | ||
| ] + envoy_select_quiche([ | ||
| "quic_bug_tracker_impl.h", | ||
| "quic_hostname_utils_impl.h", | ||
| "quic_string_utils_impl.h", | ||
| "quic_test_output_impl.h", | ||
|
|
@@ -158,7 +176,11 @@ envoy_cc_library( | |
| "spdy_test_helpers_impl.h", | ||
| "spdy_test_utils_prod_impl.h", | ||
| "spdy_unsafe_arena_impl.h", | ||
| ] + envoy_select_quiche(["spdy_string_utils_impl.h"]), | ||
| ] + envoy_select_quiche([ | ||
| "spdy_bug_tracker_impl.h", | ||
| "spdy_logging_impl.h", | ||
| "spdy_string_utils_impl.h", | ||
| ]), | ||
| external_deps = [ | ||
| "abseil_base", | ||
| "abseil_hash", | ||
|
|
@@ -168,6 +190,7 @@ envoy_cc_library( | |
| ], | ||
| visibility = ["//visibility:public"], | ||
| deps = envoy_select_quiche([ | ||
| ":quic_platform_logging_impl_lib", | ||
| ":string_utils_lib", | ||
| "//source/common/common:assert_lib", | ||
| ]), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #pragma once | ||
|
|
||
| // NOLINT(namespace-envoy) | ||
| // | ||
| // This file is part of the QUICHE platform implementation, and is not to be | ||
| // consumed or referenced directly by other Envoy code. It serves purely as a | ||
| // porting layer for QUICHE. | ||
|
|
||
| #include "extensions/quic_listeners/quiche/platform/quic_bug_tracker_impl.h" | ||
|
|
||
| #define HTTP2_BUG_IMPL QUIC_BUG_IMPL | ||
| #define HTTP2_BUG_IF_IMPL QUIC_BUG_IF_IMPL | ||
| #define FLAGS_http2_always_log_bugs_for_tests_IMPL true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #pragma once | ||
|
|
||
| // NOLINT(namespace-envoy) | ||
| // | ||
| // This file is part of the QUICHE platform implementation, and is not to be | ||
| // consumed or referenced directly by other Envoy code. It serves purely as a | ||
| // porting layer for QUICHE. | ||
|
|
||
| #include "extensions/quic_listeners/quiche/platform/quic_logging_impl.h" | ||
|
|
||
| #define HTTP2_LOG_IMPL(severity) QUIC_LOG_IMPL(severity) | ||
|
|
||
| #define HTTP2_VLOG_IMPL(verbose_level) QUIC_VLOG_IMPL(verbose_level) | ||
|
|
||
| #define HTTP2_DLOG_IMPL(severity) QUIC_DLOG_IMPL(severity) | ||
|
|
||
| #define HTTP2_DLOG_IF_IMPL(severity, condition) QUIC_DLOG_IF_IMPL(severity, condition) | ||
|
|
||
| #define HTTP2_DVLOG_IMPL(verbose_level) QUIC_DVLOG_IMPL(verbose_level) | ||
|
|
||
| #define HTTP2_DVLOG_IF_IMPL(verbose_level, condition) QUIC_DVLOG_IF_IMPL(verbose_level, condition) | ||
|
|
||
| #define HTTP2_DLOG_EVERY_N_IMPL(severity, n) QUIC_DLOG_EVERY_N_IMPL(severity, n) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,9 +6,9 @@ | |
| // consumed or referenced directly by other Envoy code. It serves purely as a | ||
| // porting layer for QUICHE. | ||
|
|
||
| #include "quiche/quic/platform/api/quic_logging.h" | ||
| #include "extensions/quic_listeners/quiche/platform/quic_logging_impl.h" | ||
|
|
||
| #define QUIC_BUG_IMPL QUIC_LOG(DFATAL) | ||
| #define QUIC_BUG_IF_IMPL(condition) QUIC_LOG_IF(DFATAL, condition) | ||
| #define QUIC_PEER_BUG_IMPL QUIC_LOG(ERROR) | ||
| #define QUIC_PEER_BUG_IF_IMPL(condition) QUIC_LOG_IF(ERROR, condition) | ||
| #define QUIC_BUG_IMPL QUIC_LOG_IMPL(DFATAL) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. preexisted, but doesn't QUIC_BUG work based on the exponential back-off, and could cause serious perf problems if we don't do that?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. QUIC_BUG has the exponential back off in google3 but not Chromium. It, like other error logs, could cause serious perf problems if it happens too frequently. TODO added to implement exponential back off in envoy.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, per-packet logging server side scales less well than client side :-) thanks for the TODO |
||
| #define QUIC_BUG_IF_IMPL(condition) QUIC_LOG_IF_IMPL(DFATAL, condition) | ||
| #define QUIC_PEER_BUG_IMPL QUIC_LOG_IMPL(ERROR) | ||
| #define QUIC_PEER_BUG_IF_IMPL(condition) QUIC_LOG_IF_IMPL(ERROR, condition) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #pragma once | ||
|
|
||
| // NOLINT(namespace-envoy) | ||
| // | ||
| // This file is part of the QUICHE platform implementation, and is not to be | ||
| // consumed or referenced directly by other Envoy code. It serves purely as a | ||
| // porting layer for QUICHE. | ||
|
|
||
| #include "extensions/quic_listeners/quiche/platform/quic_logging_impl.h" | ||
| #include "extensions/quic_listeners/quiche/platform/quic_mock_log_impl.h" | ||
|
|
||
| #define EXPECT_QUIC_BUG_IMPL(statement, regex) \ | ||
| EXPECT_QUIC_DFATAL_IMPL(statement, testing::ContainsRegex(regex)) | ||
|
|
||
| #define EXPECT_QUIC_PEER_BUG_IMPL(statement, regex) \ | ||
| EXPECT_QUIC_LOG_IMPL(statement, ERROR, testing::ContainsRegex(regex)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ namespace quic { | |
|
|
||
| namespace { | ||
| std::atomic<int> g_verbosity_threshold; | ||
| std::atomic<bool> g_dfatal_exit_disabled; | ||
|
|
||
| // Pointer to the global log sink, usually it is nullptr. | ||
| // If not nullptr, as in some tests, the sink will receive a copy of the log message right after the | ||
|
|
@@ -39,7 +40,15 @@ QuicLogEmitter::~QuicLogEmitter() { | |
| } | ||
|
|
||
| if (level_ == FATAL) { | ||
| abort(); | ||
| #ifdef NDEBUG | ||
| bool is_dfatal = false; | ||
| #else | ||
| bool is_dfatal = true; | ||
| #endif | ||
|
|
||
| if (!(is_dfatal && g_dfatal_exit_disabled)) { | ||
| abort(); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you combine this if block with the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| } | ||
| } | ||
|
|
||
|
|
@@ -49,6 +58,12 @@ void SetVerbosityLogThreshold(int new_verbosity) { | |
| g_verbosity_threshold.store(new_verbosity, std::memory_order_relaxed); | ||
| } | ||
|
|
||
| bool IsDFatalExitDisabled() { return g_dfatal_exit_disabled.load(std::memory_order_relaxed); } | ||
|
htuch marked this conversation as resolved.
|
||
|
|
||
| void SetDFatalExitDisabled(bool is_disabled) { | ||
| g_dfatal_exit_disabled.store(is_disabled, std::memory_order_relaxed); | ||
| } | ||
|
|
||
| QuicLogSink* SetLogSink(QuicLogSink* new_sink) { | ||
| absl::MutexLock lock(&g_quic_log_sink_mutex); | ||
| QuicLogSink* old_sink = g_quic_log_sink.load(std::memory_order_relaxed); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #pragma once | ||
|
|
||
| // NOLINT(namespace-envoy) | ||
| // | ||
| // This file is part of the QUICHE platform implementation, and is not to be | ||
| // consumed or referenced directly by other Envoy code. It serves purely as a | ||
| // porting layer for QUICHE. | ||
|
|
||
| #include "extensions/quic_listeners/quiche/platform/quic_bug_tracker_impl.h" | ||
|
|
||
| #define SPDY_BUG_IMPL QUIC_BUG_IMPL | ||
| #define SPDY_BUG_IF_IMPL QUIC_BUG_IF_IMPL | ||
| #define FLAGS_spdy_always_log_bugs_for_tests_impl true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #pragma once | ||
|
|
||
| // NOLINT(namespace-envoy) | ||
| // | ||
| // This file is part of the QUICHE platform implementation, and is not to be | ||
| // consumed or referenced directly by other Envoy code. It serves purely as a | ||
| // porting layer for QUICHE. | ||
|
|
||
| #include "extensions/quic_listeners/quiche/platform/quic_logging_impl.h" | ||
|
|
||
| #define SPDY_LOG_IMPL(severity) QUIC_LOG_IMPL(severity) | ||
|
|
||
| #define SPDY_VLOG_IMPL(verbose_level) QUIC_VLOG_IMPL(verbose_level) | ||
|
|
||
| #define SPDY_DLOG_IMPL(severity) QUIC_DLOG_IMPL(severity) | ||
|
|
||
| #define SPDY_DLOG_IF_IMPL(severity, condition) QUIC_DLOG_IF_IMPL(severity, condition) | ||
|
|
||
| #define SPDY_DVLOG_IMPL(verbose_level) QUIC_DVLOG_IMPL(verbose_level) | ||
|
|
||
| #define SPDY_DVLOG_IF_IMPL(verbose_level, condition) QUIC_DVLOG_IF_IMPL(verbose_level, condition) |
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.
Q please: do these API files need to be wrapped in envoy_select_quiche if their impl's are wrapping with it?
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.
It's not necessary but I moved some to envoy_select_quiche.
IIUC, this (and some other) library is not a "real" library - it does not have a "srcs" section, so "bazel build" this library "succeeds" without doing anything. But
In my past PRs, I add envoy_select_quiche when 1) ci fails on the files I'm adding or 2) I think ci will fail on the files I'm adding. It is really a bandaid to allow us to continue working on platform impls before the root of the build problem is fixed.