New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 724302 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

HttpServerPropertiesImpl broken-alt-svc expiration queue is assumed to be sorted, but it's not

Project Member Reported by wangyix@chromium.org, May 18 2017

Issue description

Chrome Version:
OS: All

What steps will reproduce the problem?
For an HttpServerPropertiesImpl instance, do:
(1) Repeatedly mark AlternativeService "foo" broken using MarkAlternativeServiceBroken(), then wait until its brokenness expires. Do this a few times.
(2) Mark "foo" broken again, then mark a different AlternativeService "bar" broken for the first time.

What is the expected result?
AlternativeService "bar"'s brokenness should expire after its computed expiration time. Since it only broke once, its expiration time is relatively close in the future. 

What happens instead?
"bar"'s brokenness will not expire until "foo"'s expiration time is reached, which is relatively far in the future because it has already been marked broken many times before.


This happens because there's a queue in HttpServerPropertiesImpl that stores expiration times for broken AlternativeServices, and there's an assumption that this queue is sorted by expiration times from earliest to latest. The task to remove expired entries from this queue is scheduled based on the expiration time of the entry at the front of this queue (i.e. whenever the next broken AlternativeService is expected to expire, schedule this task to run at that time). The queue must be sorted by expiration time for this to work, but this assumption is currently not always true.

 

Comment 1 Deleted

Project Member

Comment 2 by bugdroid1@chromium.org, Jun 1 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/64ccc57c1a20a8b2804df8a4e9be42b33b5b8f61

commit 64ccc57c1a20a8b2804df8a4e9be42b33b5b8f61
Author: wangyix <wangyix@chromium.org>
Date: Thu Jun 01 23:14:16 2017

Fix and refactor HttpServerPropertiesImpl's alternative services brokenness expiration behavior.

One of HttpServerPropertiesImpl's responsibilities is to store HTTP alternative services that have failed and keeps track of their time-until-retry (i.e. when their brokenness expires). The broken alt-svcs and their respective expiration times are kept in a list ordered by expiration time. When the expiration task runs, it drops items from the front of the list until the expiration time of the head alt-svc is no longer in the past. Turns out this list was kept in insertion order as opposed to expiration-sorted order. This change keeps this queue in expiration-sorted order, as expected.
The additional logic added to implement the above change led to a refactor of HttpServerPropertiesImpl: its broken alt-svc logic is put in its own class, BrokenAlternativeServices.

BUG= 724302 

Review-Url: https://codereview.chromium.org/2898983006
Cr-Commit-Position: refs/heads/master@{#476475}

[modify] https://crrev.com/64ccc57c1a20a8b2804df8a4e9be42b33b5b8f61/net/BUILD.gn
[add] https://crrev.com/64ccc57c1a20a8b2804df8a4e9be42b33b5b8f61/net/http/broken_alternative_services.cc
[add] https://crrev.com/64ccc57c1a20a8b2804df8a4e9be42b33b5b8f61/net/http/broken_alternative_services.h
[add] https://crrev.com/64ccc57c1a20a8b2804df8a4e9be42b33b5b8f61/net/http/broken_alternative_services_unittest.cc
[modify] https://crrev.com/64ccc57c1a20a8b2804df8a4e9be42b33b5b8f61/net/http/http_server_properties_impl.cc
[modify] https://crrev.com/64ccc57c1a20a8b2804df8a4e9be42b33b5b8f61/net/http/http_server_properties_impl.h
[modify] https://crrev.com/64ccc57c1a20a8b2804df8a4e9be42b33b5b8f61/net/http/http_server_properties_impl_unittest.cc

Status: Fixed (was: Started)

Sign in to add a comment