Skip to content

time: document that Local must not be modified #34814

@urandom

Description

@urandom

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

$ go version
go version go1.13.1 darwin/amd64

Does this issue reproduce with the latest release?

It's not reproducible every time.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="$HOME/Library/Caches/go-build"
GOENV="$HOME/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="$HOME/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.13.1/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="./backend/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/ky/99mqlqrd2rd46chcz3tqmxkw0000gn/T/go-build279362791=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Seems to be reproducible with MAX_PROCS > 2

What did you expect to see?

Nothing

What did you see instead?

WARNING: DATA RACE
Read at 0x000004186410 by goroutine 36:
  time.Now()
      /usr/local/Cellar/go/1.13.1/libexec/src/time/time.go:1100 +0xf5
  time.sendTime()
      /usr/local/Cellar/go/1.13.1/libexec/src/time/sleep.go:137 +0x44

Previous write at 0x000004186410 by main goroutine:
  [failed to restore the stack]

Goroutine 36 (running) created at:
  runtime.(*timersBucket).addtimerLocked()
      /usr/local/Cellar/go/1.13.1/libexec/src/runtime/time.go:169 +0x10d
  github.com/globalsign/mgo.newcoarseTimeProvider.func1()
      $HOME/go/pkg/mod/github.com/globalsign/mgo@v0.0.0-20181015135952-eeefdecb41b8/coarse_time.go:49 +0x50

or

WARNING: DATA RACE
Read at 0x000004186410 by goroutine 13:
  time.Now()
      /usr/local/Cellar/go/1.13.1/libexec/src/time/time.go:1100 +0xf5
  time.sendTime()
      /usr/local/Cellar/go/1.13.1/libexec/src/time/sleep.go:137 +0x44

Previous write at 0x000004186410 by main goroutine:
  [failed to restore the stack]

Goroutine 13 (running) created at:
  runtime.(*timersBucket).addtimerLocked()
      /usr/local/Cellar/go/1.13.1/libexec/src/runtime/time.go:169 +0x10d
  crypto/rand.(*devReader).Read()
      /usr/local/Cellar/go/1.13.1/libexec/src/crypto/rand/rand_unix.go:54 +0x884
  io.ReadAtLeast()
      /usr/local/Cellar/go/1.13.1/libexec/src/io/io.go:310 +0x98
  go.mongodb.org/mongo-driver/bson/primitive.readRandomUint32()
      /usr/local/Cellar/go/1.13.1/libexec/src/io/io.go:329 +0xc7
  go.mongodb.org/mongo-driver/bson/primitive.init()
      $HOME/go/pkg/mod/go.mongodb.org/mongo-driver@v1.1.1/bson/primitive/objectid.go:34 +0x95

and

WARNING: DATA RACE
Read at 0x00000417df90 by goroutine 12:
  time.Now()
      /usr/local/Cellar/go/1.13.1/libexec/src/time/time.go:1100 +0xf5
  time.sendTime()
      /usr/local/Cellar/go/1.13.1/libexec/src/time/sleep.go:137 +0x44

Previous write at 0x00000417df90 by main goroutine:
  [failed to restore the stack]

Goroutine 12 (running) created at:
  runtime.(*timersBucket).addtimerLocked()
      /usr/local/Cellar/go/1.13.1/libexec/src/runtime/time.go:169 +0x10d
  github.com/golang/glog.(*loggingT).flushDaemon()
      $HOME/go/pkg/mod/github.com/golang/glog@v0.0.0-20160126235308-23def4e6c14b/glog.go:882 +0x41

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions