Skip to content

reflect: panic: runtime error: invalid memory address or nil pointer dereference #6788

@titanous

Description

@titanous
go version devel +39c724dd7f25 Tue Nov 12 09:28:07 2013 +1100 darwin/amd64 on OS X 10.9

This is happening to me intermittently when using Packer (which uses RPC and gob quite a
bit). It appears to be a crash in reflect when the equivalent of
reflect.New(reflect.ValueOf(&rpc.Response{}).Type()).Elem() is called from
unsafeAddr in encoding/gob. So far I've been unable to replicate it outside of Packer.

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0xf pc=0x1575d1]

goroutine 36 [running]:
runtime.panic(0x360080, 0x7f8c59)
/Users/mitchellh/go/src/pkg/runtime/panic.c:266 +0xb6
encoding/gob.catchError(0xc2100861c8)
/Users/mitchellh/go/src/pkg/encoding/gob/error.go:38 +0x8f
runtime.panic(0x360080, 0x7f8c59)
/Users/mitchellh/go/src/pkg/runtime/panic.c:248 +0x106
reflect.Value.Elem(0xc2100cdc40, 0xc2101cdf08, 0x160, 0xc2101cdf08, 0x160, ...)
/Users/mitchellh/go/src/pkg/reflect/value.go:781 +0x1a1
encoding/gob.unsafeAddr(0x2a7ee0, 0xc2100d4000, 0x160, 0xc2100ce5b0)
/Users/mitchellh/go/src/pkg/encoding/gob/decode.go:1303 +0xaf
encoding/gob.(*Decoder).decodeValue(0xc2100860f0, 0xc200000044, 0x2a7ee0, 0xc2100d4000,
0x160)
/Users/mitchellh/go/src/pkg/encoding/gob/decode.go:1245 +0x30b
encoding/gob.(*Decoder).DecodeValue(0xc2100860f0, 0x2a7ee0, 0xc2100d4000, 0x160, 0x0,
...)
/Users/mitchellh/go/src/pkg/encoding/gob/decoder.go:225 +0x16c
encoding/gob.(*Decoder).Decode(0xc2100860f0, 0x2a7ee0, 0xc2100d4000, 0x0, 0x0)
/Users/mitchellh/go/src/pkg/encoding/gob/decoder.go:202 +0x1c5
net/rpc.(*gobClientCodec).ReadResponseHeader(0xc2100c2d20, 0xc2100d4000, 0xc210158130,
0x0)
/Users/mitchellh/go/src/pkg/net/rpc/client.go:221 +0x3f
net/rpc.(*Client).input(0xc2100d3000)
/Users/mitchellh/go/src/pkg/net/rpc/client.go:107 +0xbf
created by net/rpc.NewClientWithCodec
/Users/mitchellh/go/src/pkg/net/rpc/client.go:199 +0x91

Full log: https://gist.github.com/titanous/0935617ffc2615425576
Log from another user: https://gist.github.com/vjm/7491946

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