Skip to content

net/http: finishRequest() aborts ongoing background reads #17559

Closed
@JayNakrani

Description

@JayNakrani

[ continued from Issue #17547 ]

TL;DR: abortPendingRead() is called from finishRequest(), causing it to abort ongoing reads. This causes deadline_exceeded errors. finishRequest() should wait for reads to finish in normal case.

Consider following sequence of events from http.conn.serve():

  1. startBackgroundRead() starts backgroundRead() in another goroutine.
  2. Assume that backgroundRead() from above step does not finish until after the next step. (Simulated by adding sleep)
  3. finishRequest() called, which calls abortPendingRead(). abortPendingRead() then proceeds to abort ongoing background reads by setting the read deadline to aLongTimeAgo. This causes the ongoing reads to report deadline_exceeded.

/cc @bradfitz @dsnet @mdempsky

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions