Skip to content

runtime: SIGSEGV during map lookup #6194

@adonovan

Description

@adonovan
I just observed this crash caused by a segmentation fault:

unexpected fault address 0xc2212e0000
fatal error: fault
[signal 0xb code=0x1 addr=0xc2212e0000 pc=0x4f75e4]

goroutine 1 [running]:
runtime.throw(0xa01ef7)
    /home/adonovan/go3/src/pkg/runtime/panic.c:480 +0x69 fp=0x7f3db4e663f0 
runtime.sigpanic()
    /home/adonovan/go3/src/pkg/runtime/os_linux.c:240 +0xe9 fp=0x7f3db4e66408 
code.google.com/p/go.tools/pointer.nodeset.diff(0xc21d83de80, 0xc21e7ca180,
0x7f3db4e665d0)
    /home/adonovan/go3/got/src/code.google.com/p/go.tools/pointer/util.go:172 +0xa4 fp=0x7f3db4e664b0 
code.google.com/p/go.tools/pointer.(*analysis).solve(0xc219a6a5a0)

The last frame of application code is this function:

type nodeid uint32
type void struct{} // a unitary type, for use in map-based sets.
type nodeset map[nodeid]void
...
func (x nodeset) diff(y nodeset) nodeset {
    var z nodeset
    for k := range x {
        if _, ok := y[k]; !ok {  // execution is inside this hash lookup
            z.add(k)
        }
    }
    return z
}

nil is a valid and common value of y in this code.

My executable (attached) was compiled using a 6g built from head on Jul 26.

The crash is not deterministic but occurs on about 10% of runs.

Attachments:

  1. oracle (8513744 bytes)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions