Skip to content

net/http: hijack blocked sometimes #23280

Closed
@zmzmdr

Description

@zmzmdr

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.9.2 windows/amd64

Does this issue reproduce with the latest release?

Yes, but only on my computer.
Which can not be produce in my anothrer computer.

What operating system and processor architecture are you using (go env)?

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\SY-FuchunWang\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config

What did you do?

Just run the following code.

package main

import (
	"log"
	"net/http"
)

func main() {
	http.HandleFunc("/", handler)
	log.Fatal(http.ListenAndServe(":8080", nil))
}

func handler(w http.ResponseWriter, r *http.Request) {
	h := w.(http.Hijacker)
	log.Println("calling hijack")
	c, _, err := h.Hijack()
	log.Println("hijack returned err=", err)
	c.Write([]byte("HTTP/1.1 200 OK\r\n\r\nOK"))
	c.Close()
}

What did you expect to see?

Not deadlock.

What did you see instead?

Here is my log console.
Hijack blocked ofen.

2017/12/29 14:28:52 calling hijack
2017/12/29 14:28:58 calling hijack
2017/12/29 14:29:02 calling hijack
2017/12/29 14:29:09 calling hijack
2017/12/29 14:29:09 hijack returned err= <nil>
2017/12/29 14:29:09 calling hijack
2017/12/29 14:29:09 hijack returned err= <nil>
2017/12/29 14:29:11 calling hijack
2017/12/29 14:29:12 calling hijack
2017/12/29 14:29:12 calling hijack

My system time is 2017/12/29 .

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.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions