<p dir="auto">by <strong>jeroen.j.dirks</strong>:</p>
<pre class="notranslate">What steps will reproduce the problem?
The following code compiles and links but when run does not reach the end of the
program. (I think I do not initialize the map propperly but would expect some type of
runtime error reported.)

package main

import ( "fmt" )

type Item struct {
    name string
    value int
}

type ItemMap map[string] *Item

type Model struct {
    im ItemMap
}

func main() {
    item := new(Item)
    item.name = "Test"
    // im := make(ItemMap)
    model := new(Model)
    model.im[item.name] = item
    fmt.Printf("Got here?")
}

What is the expected output?
A runtime error message.

What do you see instead?
program exists at the model.im[item.name] = item line with no other messages.

Which compiler are you using (5g, 6g, 8g, gccgo)?
8g

Which operating system are you using?
Windows XP Pro

Which revision are you using?  (hg identify)
gowin32_2011-01-06.zip
downloaded from
<a href="http://code.google.com/p/gomingw/downloads/list" rel="nofollow">http://code.google.com/p/gomingw/downloads/list</a>

Please provide any additional information below.</pre>
<p dir="auto">by <strong>tarmigan</strong>:</p>
<pre class="notranslate">I have a go program that does about 3000 http.Get() calls and parses the results.  This
program used to work (last time I rebuilt it was few months ago), but after updating to
hg 14e85394f65e ("http: close underlying gzip Reader too") it panics.  
Looking at the backtrace, I don't think my program is at fault.  Looks like bufio got
into an inconsistent state somehow.  I have reproduced it twice now, so I may be able to
add debugging prints if needed.

GOOS=darwin GOARCH=386

Thanks,
Tarmigan


panic: runtime error: slice bounds out of range

runtime.panic+0x92 /Users/tarm/devel/go/src/pkg/runtime/proc.c:1034
    runtime.panic(0xf1a8c, 0x10b19018)
runtime.panicstring+0x8f /Users/tarm/devel/go/src/pkg/runtime/runtime.c:116
    runtime.panicstring(0x1d5879, 0x0)
runtime.panicslice+0x24 /Users/tarm/devel/go/src/pkg/runtime/runtime.c:79
    runtime.panicslice()
bufio.*Reader·ReadSlice+0x6b /Users/tarm/devel/go/src/pkg/bufio/bufio.go:252
    bufio.*Reader·ReadSlice(0x10906f90, 0xa, 0x0, 0x0, 0x0, ...)
bufio.*Reader·ReadBytes+0x84 /Users/tarm/devel/go/src/pkg/bufio/bufio.go:327
    bufio.*Reader·ReadBytes(0x10906f90, 0xa, 0x0, 0x0, 0x0, ...)
net/textproto.*Reader·ReadLineBytes+0x39
/Users/tarm/devel/go/src/pkg/net/textproto/reader.go:43
    net/textproto.*Reader·ReadLineBytes(0x10b19010, 0x0, 0x0)
net/textproto.*Reader·ReadLine+0x26
/Users/tarm/devel/go/src/pkg/net/textproto/reader.go:36
    net/textproto.*Reader·ReadLine(0x10b19010, 0x3, 0x105a98)
http.ReadResponse+0x96 /Users/tarm/devel/go/src/pkg/http/response.go:88
    http.ReadResponse(0x10906f90, 0x105a98, 0x3, 0x10855300, 0x0, ...)
http.readResponseWithEOFSignal+0x3b /Users/tarm/devel/go/src/pkg/http/transport.go:577
    http.readResponseWithEOFSignal(0x10906f90, 0x105a98, 0x3, 0x0, 0x0, ...)
http.*ClientConn·Read+0x2fd /Users/tarm/devel/go/src/pkg/http/persist.go:368
    http.*ClientConn·Read(0x10a7d930, 0x10d04e00, 0x0, 0x0, 0x0, ...)
http.*persistConn·readLoop+0x246 /Users/tarm/devel/go/src/pkg/http/transport.go:450
    http.*persistConn·readLoop(0x108fbd00, 0xea23)
runtime.goexit /Users/tarm/devel/go/src/pkg/runtime/proc.c:178
    runtime.goexit()
----- goroutine created by -----
http.*Transport·getConn+0x4db /Users/tarm/devel/go/src/pkg/http/transport.go:289

goroutine 5470 [4]:
runtime.gosched+0x61 /Users/tarm/devel/go/src/pkg/runtime/proc.c:600
    runtime.gosched()
runtime.chanrecv+0x3af /Users/tarm/devel/go/src/pkg/runtime/chan.c:329
    runtime.chanrecv(0x108c9b40, 0x67ee38, 0x0, 0x0, 0x67ee40, ...)
runtime.chanrecv1+0x3f /Users/tarm/devel/go/src/pkg/runtime/chan.c:424
    runtime.chanrecv1(0x108c9b40, 0x108551e0)
http.*persistConn·readLoop+0x437 /Users/tarm/devel/go/src/pkg/http/transport.go:481
    http.*persistConn·readLoop(0x10987200, 0xea23)
runtime.goexit /Users/tarm/devel/go/src/pkg/runtime/proc.c:178
    runtime.goexit()
----- goroutine created by -----
http.*Transport·getConn+0x4db /Users/tarm/devel/go/src/pkg/http/transport.go:289

goroutine 5469 [4]:
runtime.gosched+0x61 /Users/tarm/devel/go/src/pkg/runtime/proc.c:600
    runtime.gosched()
runtime.chanrecv+0x3af /Users/tarm/devel/go/src/pkg/runtime/chan.c:329
    runtime.chanrecv(0x108c96c0, 0x67de38, 0x0, 0x0, 0x67de40, ...)
runtime.chanrecv1+0x3f /Users/tarm/devel/go/src/pkg/runtime/chan.c:424
    runtime.chanrecv1(0x108c96c0, 0x10855120)
http.*persistConn·readLoop+0x437 /Users/tarm/devel/go/src/pkg/http/transport.go:481
    http.*persistConn·readLoop(0x108c9800, 0xea23)
runtime.goexit /Users/tarm/devel/go/src/pkg/runtime/proc.c:178
    runtime.goexit()
----- goroutine created by -----
http.*Transport·getConn+0x4db /Users/tarm/devel/go/src/pkg/http/transport.go:289

goroutine 5420 [1]:
runtime.gosched+0x61 /Users/tarm/devel/go/src/pkg/runtime/proc.c:600
    runtime.gosched()
runtime.exitsyscall+0x64 /Users/tarm/devel/go/src/pkg/runtime/proc.c:665
    runtime.exitsyscall()
syscall.Syscall6+0x4b /Users/tarm/devel/go/src/pkg/syscall/asm_darwin_386.s:61
    syscall.Syscall6()
syscall.kevent+0x58 /Users/tarm/devel/go/src/pkg/syscall/zsyscall_darwin_386.go:158
    syscall.kevent(0x11, 0x1082cfd8, 0x1, 0x1082cfd8, 0x1, ...)
syscall.Kevent+0x84 /Users/tarm/devel/go/src/pkg/syscall/syscall_bsd.go:441
    syscall.Kevent(0x11, 0x1082cfd8, 0x1, 0x1, 0x1082cfd8, ...)
net.*pollster·AddFD+0x133 /Users/tarm/devel/go/src/pkg/net/fd_darwin.go:54
    net.*pollster·AddFD(0x1082cf00, 0x29, 0x72, 0x0, 0x8, ...)
net.*pollServer·AddFD+0x1b0 /Users/tarm/devel/go/src/pkg/net/fd.go:125
    net.*pollServer·AddFD(0x108a1f90, 0x10be6e00, 0x72, 0x4)
net.*pollServer·WaitRead+0x36 /Users/tarm/devel/go/src/pkg/net/fd.go:254
    net.*pollServer·WaitRead(0x108a1f90, 0x10be6e00, 0x1000)
net.*netFD·Read+0x1be /Users/tarm/devel/go/src/pkg/net/fd.go:380
    net.*netFD·Read(0x10be6e00, 0x10a76000, 0x1000, 0x1000, 0x0, ...)
net.*TCPConn·Read+0x6d /Users/tarm/devel/go/src/pkg/net/tcpsock.go:94
    net.*TCPConn·Read(0x109e1bf8, 0x10a76000, 0x1000, 0x1000, 0x0, ...)
bufio.*Reader·fill+0x14f /Users/tarm/devel/go/src/pkg/bufio/bufio.go:97
    bufio.*Reader·fill(0x10ba1900, 0x20)
bufio.*Reader·Peek+0xb5 /Users/tarm/devel/go/src/pkg/bufio/bufio.go:116
    bufio.*Reader·Peek(0x10ba1900, 0x1, 0x0, 0x0)
http.*persistConn·readLoop+0x7f /Users/tarm/devel/go/src/pkg/http/transport.go:433
    http.*persistConn·readLoop(0x10ab6600, 0xea23)
runtime.goexit /Users/tarm/devel/go/src/pkg/runtime/proc.c:178
    runtime.goexit()
----- goroutine created by -----
http.*Transport·getConn+0x4db /Users/tarm/devel/go/src/pkg/http/transport.go:289

goroutine 5286 [4]:
runtime.gosched+0x61 /Users/tarm/devel/go/src/pkg/runtime/proc.c:600
    runtime.gosched()
runtime.chanrecv+0x14d /Users/tarm/devel/go/src/pkg/runtime/chan.c:361
    runtime.chanrecv(0x109873c0, 0x673b78, 0x0, 0x0, 0x1000, ...)
runtime.chanrecv1+0x3f /Users/tarm/devel/go/src/pkg/runtime/chan.c:424
    runtime.chanrecv1(0x109873c0, 0x10f37c00)
net.*pollServer·WaitRead+0x47 /Users/tarm/devel/go/src/pkg/net/fd.go:255
    net.*pollServer·WaitRead(0x108a1f90, 0x10f37c00, 0x1000)
net.*netFD·Read+0x1be /Users/tarm/devel/go/src/pkg/net/fd.go:380
    net.*netFD·Read(0x10f37c00, 0x111ba000, 0x1000, 0x1000, 0x0, ...)
net.*TCPConn·Read+0x6d /Users/tarm/devel/go/src/pkg/net/tcpsock.go:94
    net.*TCPConn·Read(0x109e1858, 0x111ba000, 0x1000, 0x1000, 0x0, ...)
bufio.*Reader·fill+0x14f /Users/tarm/devel/go/src/pkg/bufio/bufio.go:97
    bufio.*Reader·fill(0x10f2a8d0, 0x20)
bufio.*Reader·Peek+0xb5 /Users/tarm/devel/go/src/pkg/bufio/bufio.go:116
    bufio.*Reader·Peek(0x10f2a8d0, 0x1, 0x0, 0x0)
http.*persistConn·readLoop+0x7f /Users/tarm/devel/go/src/pkg/http/transport.go:433
    http.*persistConn·readLoop(0x10c52840, 0xea23)
runtime.goexit /Users/tarm/devel/go/src/pkg/runtime/proc.c:178
    runtime.goexit()
----- goroutine created by -----

[ more backtrace.  Can include if needed]</pre>