Open syslot opened 8 years ago
Are there any steps to reproduce the crash?
Here is the source, run it and gom
package main
import (
"log"
"net/http"
_ "github.com/rakyll/gom/http"
)
func handler(rw http.ResponseWriter, req *http.Request) {
rw.Write([]byte(`ok`))
}
func main() {
go func() {
http.HandleFunc("/test", handler)
http.ListenAndServe("localhost:8087", nil)
}()
log.Println(http.ListenAndServe("localhost:6060", nil))
}
I was not able to reproduce it yet but since it is coming from github.com/gizak/termui.Init
, maybe we should file it against the termui repo.
Hi, just now I got a crash while testing gom, here is the panic stack.
My test env : go1.5.2 linux/amd64,Ubuntu 14.04.3 LTS
panic: bytes.Buffer: truncation out of range
goroutine 36 [running]: bytes.(_Buffer).Truncate(0xa70fe0, 0x0) /usr/local/go/src/bytes/buffer.go:69 +0xbf bytes.(_Buffer).WriteTo(0xa70fe0, 0x7f2f7a1fa2e0, 0xc820090108, 0x3a2, 0x0, 0x0) /usr/local/go/src/bytes/buffer.go:222 +0x1af io.copyBuffer(0x7f2f7a1fa2e0, 0xc820090108, 0x7f2f799b5000, 0xa70fe0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) /usr/local/go/src/io/io.go:371 +0xd0 io.Copy(0x7f2f7a1fa2e0, 0xc820090108, 0x7f2f799b5000, 0xa70fe0, 0x85c6d0, 0x0, 0x0) /usr/local/go/src/io/io.go:351 +0x64 github.com/nsf/termbox-go.flush(0x0, 0x0) /home/yuning/gopath/src/github.com/nsf/termbox-go/termbox.go:234 +0x96 github.com/nsf/termbox-go.send_clear(0x0, 0x0) /home/yuning/gopath/src/github.com/nsf/termbox-go/termbox.go:257 +0xd3 github.com/nsf/termbox-go.Sync(0x0, 0x0) /home/yuning/gopath/src/github.com/nsf/termbox-go/api.go:453 +0x34 github.com/gizak/termui.TermWidth(0x0) /home/yuning/gopath/src/github.com/gizak/termui/render.go:65 +0x18 github.com/gizak/termui.TermRect(0x0, 0x0, 0x0, 0x0) /home/yuning/gopath/src/github.com/gizak/termui/pos.go:70 +0x2e github.com/gizak/termui.(_Block).Align(0xc820184000) /home/yuning/gopath/src/github.com/gizak/termui/block.go:160 +0x4e github.com/gizak/termui.(_Block).Buffer(0xc820184000, 0x0, 0x0, 0x0, 0x0, 0x0) /home/yuning/gopath/src/github.com/gizak/termui/block.go:195 +0x5d github.com/gizak/termui.(*Par).Buffer(0xc820184000, 0x0, 0x0, 0x0, 0x0, 0x0) /home/yuning/gopath/src/github.com/gizak/termui/par.go:33 +0x68 github.com/gizak/termui.render(0xc8203802e0, 0x1, 0x1) /home/yuning/gopath/src/github.com/gizak/termui/render.go:83 +0xe1 github.com/gizak/termui.Init.func1() /home/yuning/gopath/src/github.com/gizak/termui/render.go:31 +0x95 created by github.com/gizak/termui.Init /home/yuning/gopath/src/github.com/gizak/termui/render.go:33 +0x10b