Skip to content

net/http: TimeoutHandler timing out instantly #14568

Closed
@dim

Description

@dim

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
go version go1.6 linux/amd64
  1. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GORACE=""
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
  1. What did you do?
    (Use play.golang.org to provide a runnable example, if possible.)
    http://play.golang.org/p/K9IgiTNaFk
  2. What did you expect to see?
    204 No content
  3. What did you see instead?
    503 Service Unavailable

It looks like the timer of the timoutHandler is created when the handler is wrapped in

t := time.NewTimer(dt)
. By the time the request is actually made, timer.C will have already triggered.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions