-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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 all 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 |
|---|---|---|
| @@ -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,11 @@ | |
| // 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) | ||
| // TODO(wub): Implement exponential back off to avoid performance problems due | ||
| // to excessive QUIC_BUG. | ||
| #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) { | ||
| #ifdef NDEBUG | ||
| // Release mode. | ||
| abort(); | ||
| #else | ||
| // Debug mode. | ||
| if (!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. |
||
| #endif | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -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.
Show resolved
Hide 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 |
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.
does this need to be wrapped in
envoy_select_quiche?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, libraries depend on this is using envoy_select_quiche.