Skip to content

runtime/race: race detector not detecting data race when mutex is used #18668

@sarathsp06

Description

@sarathsp06

What version of Go are you using (go version)?

go version go1.6.4 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/sarath/go"
GORACE=""
GOROOT="/home/sarath/goroot"
GOTOOLDIR="/home/sarath/goroot/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

What did you do?

I tried making a go program that has two routines runnig that writes to and read from a variable . The writes and read were protected by locks ,but since locks does not guarantee order of execution data race could happen . The race detector is not detecting that

Here is play link : https://play.golang.org/p/MGpRIkE2-L

What did you expect to see?

Data race error stack

What did you see instead?

No data race detected though it occured

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