Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Issue 2322423002: Disable QUIC for 5 miuntes, subject to exponential backoff, when (Closed)

Created:
4 years, 3 months ago by Ryan Hamilton
Modified:
4 years, 3 months ago
Reviewers:
ianswett
CC:
chromium-reviews, cbentzel+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Disable QUIC for 5 miuntes, subject to exponential backoff, when sessions timeout with open streams. Committed: https://crrev.com/f10ad270e18d0b8c11110ba9a314a58f7ea544f0 Cr-Commit-Position: refs/heads/master@{#418682}

Patch Set 1 #

Patch Set 2 : cronet! #

Patch Set 3 : Rebase #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+234 lines, -1 line) Patch
M net/quic/chromium/quic_stream_factory.h View 2 chunks +10 lines, -0 lines 1 comment Download
M net/quic/chromium/quic_stream_factory.cc View 5 chunks +34 lines, -1 line 2 comments Download
M net/quic/chromium/quic_stream_factory_test.cc View 1 chunk +190 lines, -0 lines 1 comment Download

Depends on Patchset:

Messages

Total messages: 8 (3 generated)
Ryan Hamilton
I hope (believe! :>) this is what we discussed...
4 years, 3 months ago (2016-09-12 19:18:05 UTC) #2
ianswett
lgtm A few nits, but this looks great. It's surprisingly simple as well. Nicely done! ...
4 years, 3 months ago (2016-09-14 20:10:14 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2322423002/40001
4 years, 3 months ago (2016-09-14 20:10:54 UTC) #5
commit-bot: I haz the power
Patchset 3 (id:??) landed as https://crrev.com/f10ad270e18d0b8c11110ba9a314a58f7ea544f0 Cr-Commit-Position: refs/heads/master@{#418682}
4 years, 3 months ago (2016-09-14 21:34:27 UTC) #7
commit-bot: I haz the power
4 years, 3 months ago (2016-09-14 21:35:05 UTC) #8
Message was sent while issue was closed.
Failed to apply patch for net/quic/chromium/quic_stream_factory.cc:
While running git apply --index -3 -p1;
  error: patch failed: net/quic/chromium/quic_stream_factory.cc:90
  error: repository lacks the necessary blob to fall back on 3-way merge.
  error: net/quic/chromium/quic_stream_factory.cc: patch does not apply

Patch:       net/quic/chromium/quic_stream_factory.cc
Index: net/quic/chromium/quic_stream_factory.cc
diff --git a/net/quic/chromium/quic_stream_factory.cc
b/net/quic/chromium/quic_stream_factory.cc
index
8212a9c0366cecc3cf5d4a411710c79a23eee8df..b645b65c0be2d963ae446f03cda332f1260c00fb
100644
--- a/net/quic/chromium/quic_stream_factory.cc
+++ b/net/quic/chromium/quic_stream_factory.cc
@@ -90,6 +90,9 @@ const int32_t kQuicStreamMaxRecvWindowSize = 6 * 1024 * 1024; 
  // 6 MB
 // Set the maximum number of undecryptable packets the connection will store.
 const int32_t kMaxUndecryptablePackets = 100;
 
+// How long QUIC will be disabled for because of timeouts with open streams.
+const int kDisableQuicTimeoutSecs = 5 * 60;
+
 std::unique_ptr<base::Value> NetLogQuicConnectionMigrationTriggerCallback(
     std::string trigger,
     NetLogCaptureMode capture_mode) {
@@ -774,6 +777,8 @@ QuicStreamFactory::QuicStreamFactory(
       prefer_aes_(prefer_aes),
       disable_quic_on_timeout_with_open_streams_(
           disable_quic_on_timeout_with_open_streams),
+      consecutive_disabled_count_(0),
+      need_to_evaluate_consecutive_disabled_count_(false),
       socket_receive_buffer_size_(socket_receive_buffer_size),
       delay_tcp_race_(delay_tcp_race),
       ping_timeout_(QuicTime::Delta::FromSeconds(kPingTimeoutSecs)),
@@ -1208,8 +1213,18 @@ void QuicStreamFactory::OnTimeoutWithOpenStreams() {
   if (ping_timeout_ > reduced_ping_timeout_) {
     ping_timeout_ = reduced_ping_timeout_;
   }
-  if (disable_quic_on_timeout_with_open_streams_)
+  if (disable_quic_on_timeout_with_open_streams_) {
+    if (status_ == OPEN) {
+      task_runner_->PostDelayedTask(
+          FROM_HERE, base::Bind(&QuicStreamFactory::OpenFactory,
+                                weak_factory_.GetWeakPtr()),
+          base::TimeDelta::FromSeconds(kDisableQuicTimeoutSecs *
+                                       (1 << consecutive_disabled_count_)));
+      consecutive_disabled_count_++;
+      need_to_evaluate_consecutive_disabled_count_ = true;
+    }
     status_ = CLOSED;
+  }
 }
 
 void QuicStreamFactory::CancelRequest(QuicStreamRequest* request) {
@@ -1593,6 +1608,15 @@ int QuicStreamFactory::CreateSession(
     base::TimeTicks dns_resolution_end_time,
     const BoundNetLog& net_log,
     QuicChromiumClientSession** session) {
+  if (need_to_evaluate_consecutive_disabled_count_) {
+    task_runner_->PostDelayedTask(
+        FROM_HERE,
+        base::Bind(&QuicStreamFactory::MaybeClearConsecutiveDisabledCount,
+                   weak_factory_.GetWeakPtr()),
+        base::TimeDelta::FromSeconds(kDisableQuicTimeoutSecs));
+
+    need_to_evaluate_consecutive_disabled_count_ = false;
+  }
   TRACE_EVENT0("net", "QuicStreamFactory::CreateSession");
   IPEndPoint addr = *address_list.begin();
   bool enable_port_selection = enable_port_selection_;
@@ -1885,4 +1909,13 @@ void QuicStreamFactory::ProcessGoingAwaySession(
       alternative_service);
 }
 
+void QuicStreamFactory::OpenFactory() {
+  status_ = OPEN;
+}
+
+void QuicStreamFactory::MaybeClearConsecutiveDisabledCount() {
+  if (status_ == OPEN)
+    consecutive_disabled_count_ = 0;
+}
+
 }  // namespace net

Powered by Google App Engine
This is Rietveld 408576698