Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: slice bounds out of range bug #18276

Closed
iosplist opened this issue Dec 10, 2016 · 4 comments
Closed

net/http: slice bounds out of range bug #18276

iosplist opened this issue Dec 10, 2016 · 4 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@iosplist
Copy link

go version go1.7.4 linux/amd64

NAME="Ubuntu"
VERSION="14.04.3 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.3 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

2016/12/10 13:37:48 http: panic serving 10.10.10.10:28550: runtime error: slice bounds out of range
goroutine 3039965 [running]:
net/http.(*conn).serve.func1(0xc4218d0b00)
/home/ximi/golang/src/net/http/server.go:1491 +0x12a
panic(0x8037c0, 0xc42000c100)
/home/ximi/golang/src/runtime/panic.go:458 +0x243
bufio.(*Writer).flush(0xc42ab52bc0, 0x0, 0x0)
/home/ximi/golang/src/bufio/bufio.go:569 +0x177
bufio.(*Writer).Flush(0xc42ab52bc0, 0x0, 0x0)
/home/ximi/golang/src/bufio/bufio.go:552 +0x2b
net/http.(*response).finishRequest(0xc429d94a90)
/home/ximi/golang/src/net/http/server.go:1355 +0x8f
net/http.(*conn).serve(0xc4218d0b00, 0xa87be0, 0xc42ab52c00)
/home/ximi/golang/src/net/http/server.go:1584 +0x4f7
created by net/http.(*Server).Serve
/home/ximi/golang/src/net/http/server.go:2293 +0x44d
panic: runtime error: slice bounds out of range [recovered]
panic: runtime error: slice bounds out of range

goroutine 3039965 [running]:
panic(0x8037c0, 0xc42000c100)
/home/ximi/golang/src/runtime/panic.go:500 +0x1a1
bufio.(*Writer).flush(0xc42ab52bc0, 0xffffffffffffffff, 0xffffffffffffffff)
/home/ximi/golang/src/bufio/bufio.go:563 +0x1b5
bufio.(*Writer).Flush(0xc42ab52bc0, 0xc429aecf40, 0xc42bf27ae0)
/home/ximi/golang/src/bufio/bufio.go:552 +0x2b
net/http.(*conn).finalFlush(0xc4218d0b00)
/home/ximi/golang/src/net/http/server.go:1416 +0x47
net/http.(*conn).close(0xc4218d0b00)
/home/ximi/golang/src/net/http/server.go:1426 +0x2b
net/http.(*conn).serve.func1(0xc4218d0b00)
/home/ximi/golang/src/net/http/server.go:1495 +0xa9
panic(0x8037c0, 0xc42000c100)
/home/ximi/golang/src/runtime/panic.go:458 +0x243
bufio.(*Writer).flush(0xc42ab52bc0, 0x0, 0x0)
/home/ximi/golang/src/bufio/bufio.go:569 +0x177
bufio.(*Writer).Flush(0xc42ab52bc0, 0x0, 0x0)
/home/ximi/golang/src/bufio/bufio.go:552 +0x2b
net/http.(*response).finishRequest(0xc429d94a90)
/home/ximi/golang/src/net/http/server.go:1355 +0x8f
net/http.(*conn).serve(0xc4218d0b00, 0xa87be0, 0xc42ab52c00)
/home/ximi/golang/src/net/http/server.go:1584 +0x4f7
created by net/http.(*Server).Serve
/home/ximi/golang/src/net/http/server.go:2293 +0x44d

@minux
Copy link
Member

minux commented Dec 10, 2016 via email

@bradfitz bradfitz changed the title net/http slice bounds out of range bug net/http: slice bounds out of range bug Dec 10, 2016
@bradfitz bradfitz added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 10, 2016
@bradfitz bradfitz added this to the Unplanned milestone Dec 10, 2016
@iosplist
Copy link
Author

iosplist commented Dec 14, 2016

not every time

type HttpContext struct {
Res http.ResponseWriter
Req *http.Request
}

func (s *Service) ProcessHttpCmd(h *HttpContext) {
.........
h.Res.Write([]byte(.....))
}

var s Service

func main() {
s = new(Service)
http.HandleFunc("/cmd", httpCmdHandle)
err := http.ListenAndServe(p.HttpUrl, nil)
if err != nil {
panic(err.Error())
}
}

func httpCmdHandle(w http.ResponseWriter, req *http.Request) {
req.ParseForm()
var context HttpContext = HttpContext{w, req}
s.ProcessHttpCmd(&context)
}

@bradfitz
Copy link
Contributor

Sure you're never using that "HttpContext" in a different goroutine after httpCmdHandler returns?

@bradfitz
Copy link
Contributor

bradfitz commented Jan 4, 2017

No answer. Timed out.

@bradfitz bradfitz closed this as completed Jan 4, 2017
@golang golang locked and limited conversation to collaborators Jan 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants