Skip to content

runtime/race: instrument Sendmsg/Recvmsg and FlockΒ #5363

@alberts

Description

@alberts
What steps will reproduce the problem?

write a program that synchronizes due to calls to Sendmsg and Recvmsg

build and test with -race

What do you see instead?

a race is detected

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

6g

Which operating system are you using?

linux

Which version are you using?  (run 'go version')

tip

Please provide any additional information below.

Dmitry helped me debug this. Recvmsg needs:

  if rsa.Addr.Family != AF_UNSPEC {
  from, err = anyToSockaddr(&rsa)
  }
+ if raceenabled && err == nil {
+ raceAcquire(unsafe.Pointer(&ioSync))
+ }

Sendmsg needs:

  msg.Iov = &iov
  msg.Iovlen = 1
+ if raceenabled {
+ raceReleaseMerge(unsafe.Pointer(&ioSync))
+ }

Dmitry suggested that this is for after Go 1.1. Since it's a small fix, it would be nice
to do it before, but we can wait.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions