Skip to content

encoding/xml: data race #11885

Closed
Closed
@ianlancetaylor

Description

@ianlancetaylor

After https://golang.org/cl/12570 the race builders are failing fairly consistently with a data race in encoding/xml. Sample race:

WARNING: DATA RACE
Write by goroutine 20:
runtime.slicecopy()
/tmp/workdir/go/src/runtime/slice.go:110 +0x0
encoding/xml.(_parentStack).push()
/tmp/workdir/go/src/encoding/xml/marshal.go:959 +0x31c
encoding/xml.(_printer).marshalStruct()
/tmp/workdir/go/src/encoding/xml/marshal.go:877 +0x586
encoding/xml.(_printer).marshalValue()
/tmp/workdir/go/src/encoding/xml/marshal.go:576 +0x14c2
encoding/xml.(_Encoder).Encode()
/tmp/workdir/go/src/encoding/xml/marshal.go:153 +0xaf
encoding/xml.Marshal()
/tmp/workdir/go/src/encoding/xml/marshal.go:72 +0x213
encoding/xml.TestRace9796.func1()
/tmp/workdir/go/src/encoding/xml/marshal_test.go:1698 +0xbd

Previous read by goroutine 19:
encoding/xml.(_parentStack).trim()
/tmp/workdir/go/src/encoding/xml/marshal.go:944 +0x2a8
encoding/xml.(_printer).marshalStruct()
/tmp/workdir/go/src/encoding/xml/marshal.go:887 +0x1ce
encoding/xml.(_printer).marshalValue()
/tmp/workdir/go/src/encoding/xml/marshal.go:576 +0x14c2
encoding/xml.(_Encoder).Encode()
/tmp/workdir/go/src/encoding/xml/marshal.go:153 +0xaf
encoding/xml.Marshal()
/tmp/workdir/go/src/encoding/xml/marshal.go:72 +0x213
encoding/xml.TestRace9796.func1()
/tmp/workdir/go/src/encoding/xml/marshal_test.go:1698 +0xbd

Goroutine 20 (running) created at:
encoding/xml.TestRace9796()
/tmp/workdir/go/src/encoding/xml/marshal_test.go:1700 +0x96
testing.tRunner()
/tmp/workdir/go/src/testing/testing.go:456 +0xdc

Goroutine 19 (running) created at:
encoding/xml.TestRace9796()
/tmp/workdir/go/src/encoding/xml/marshal_test.go:1700 +0x96
testing.tRunner()
/tmp/workdir/go/src/testing/testing.go:456 +0xdc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions