Skip to content

Running go test -race results in data races #629

@pjbgf

Description

@pjbgf

Running go test -race ./... results in:

==================
WARNING: DATA RACE
Write at 0x00c000510640 by goroutine 149:
  github.com/go-git/go-billy/v5/memfs.(*content).WriteAt()
      /home/levi/go/pkg/mod/github.com/go-git/go-billy/v5@v5.3.1/memfs/storage.go:195 +0x496
  github.com/go-git/go-billy/v5/memfs.(*file).Write()
      /home/levi/go/pkg/mod/github.com/go-git/go-billy/v5@v5.3.1/memfs/memory.go:280 +0xc6
  github.com/go-git/go-billy/v5/helper/chroot.(*file).Write()
      <autogenerated>:1 +0x76
  github.com/go-git/go-git/v5/storage/filesystem/dotgit.(*syncedReader).Write()
      /home/levi/go/src/github.com/fluxcd/go-git/storage/filesystem/dotgit/writers.go:186 +0x106
  github.com/go-git/go-git/v5/storage/filesystem/dotgit.(*PackWriter).Write()
      /home/levi/go/src/github.com/fluxcd/go-git/storage/filesystem/dotgit/writers.go:90 +0x65
  io.copyBuffer()
      /usr/local/go/src/io/io.go:429 +0x2de
  io.Copy()
      /usr/local/go/src/io/io.go:386 +0x54c
  github.com/go-git/go-git/v5/storage/test.(*BaseStorageSuite).TestPackfileWriter()
      /home/levi/go/src/github.com/fluxcd/go-git/storage/test/storage_suite.go:161 +0xb9
  github.com/go-git/go-git/v5/storage/transactional.(*StorageSuite).TestPackfileWriter()
      <autogenerated>:1 +0x44
  runtime.call16()
      /usr/local/go/src/runtime/asm_amd64.s:724 +0x48
  reflect.Value.Call()
      /usr/local/go/src/reflect/value.go:368 +0xc7
  gopkg.in/check%2ev1.(*suiteRunner).forkTest.func1()
      /home/levi/go/pkg/mod/gopkg.in/check.v1@v1.0.0-20201130134442-10cb98267c6c/check.go:775 +0xad4
  gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
      /home/levi/go/pkg/mod/gopkg.in/check.v1@v1.0.0-20201130134442-10cb98267c6c/check.go:669 +0xec

Previous read at 0x00c000510640 by goroutine 151:
  github.com/go-git/go-billy/v5/memfs.(*content).ReadAt()
      /home/levi/go/pkg/mod/github.com/go-git/go-billy/v5@v5.3.1/memfs/storage.go:212 +0x1d1
  github.com/go-git/go-billy/v5/memfs.(*file).ReadAt()
      /home/levi/go/pkg/mod/github.com/go-git/go-billy/v5@v5.3.1/memfs/memory.go:249 +0xd0
  github.com/go-git/go-billy/v5/memfs.(*file).Read()
      /home/levi/go/pkg/mod/github.com/go-git/go-billy/v5@v5.3.1/memfs/memory.go:230 +0x76
  github.com/go-git/go-billy/v5/helper/chroot.(*file).Read()
      <autogenerated>:1 +0x76
  github.com/go-git/go-git/v5/storage/filesystem/dotgit.(*syncedReader).Read()
      /home/levi/go/src/github.com/fluxcd/go-git/storage/filesystem/dotgit/writers.go:195 +0x152
  bufio.(*Reader).Read()
      /usr/local/go/src/bufio/bufio.go:237 +0x4f2
  github.com/go-git/go-git/v5/plumbing/format/packfile.(*scannerReader).Read()
      /home/levi/go/src/github.com/fluxcd/go-git/plumbing/format/packfile/scanner.go:434 +0x6b
  io.ReadAtLeast()
      /usr/local/go/src/io/io.go:332 +0xdd
  io.ReadFull()
      /usr/local/go/src/io/io.go:351 +0x72
  github.com/go-git/go-git/v5/plumbing/format/packfile.(*Scanner).readSignature()
      /home/levi/go/src/github.com/fluxcd/go-git/plumbing/format/packfile/scanner.go:119 +0x40
  github.com/go-git/go-git/v5/plumbing/format/packfile.(*Scanner).Header()
      /home/levi/go/src/github.com/fluxcd/go-git/plumbing/format/packfile/scanner.go:86 +0x6f
  github.com/go-git/go-git/v5/plumbing/format/packfile.(*Parser).init()
      /home/levi/go/src/github.com/fluxcd/go-git/plumbing/format/packfile/parser.go:161 +0x64
  github.com/go-git/go-git/v5/plumbing/format/packfile.(*Parser).Parse()
      /home/levi/go/src/github.com/fluxcd/go-git/plumbing/format/packfile/parser.go:135 +0x59
  github.com/go-git/go-git/v5/storage/filesystem/dotgit.(*PackWriter).buildIndex()
      /home/levi/go/src/github.com/fluxcd/go-git/storage/filesystem/dotgit/writers.go:67 +0x48c
  github.com/go-git/go-git/v5/storage/filesystem/dotgit.newPackWrite.func1()
      /home/levi/go/src/github.com/fluxcd/go-git/storage/filesystem/dotgit/writers.go:53 +0x39

Goroutine 149 (running) created at:
  gopkg.in/check%2ev1.(*suiteRunner).forkCall()
      /home/levi/go/pkg/mod/gopkg.in/check.v1@v1.0.0-20201130134442-10cb98267c6c/check.go:666 +0x5c4
  gopkg.in/check%2ev1.(*suiteRunner).forkTest()
      /home/levi/go/pkg/mod/gopkg.in/check.v1@v1.0.0-20201130134442-10cb98267c6c/check.go:757 +0x16b
  gopkg.in/check%2ev1.(*suiteRunner).runTest()
      /home/levi/go/pkg/mod/gopkg.in/check.v1@v1.0.0-20201130134442-10cb98267c6c/check.go:812 +0x439
  gopkg.in/check%2ev1.(*suiteRunner).run()
      /home/levi/go/pkg/mod/gopkg.in/check.v1@v1.0.0-20201130134442-10cb98267c6c/check.go:618 +0x3e6
  gopkg.in/check%2ev1.Run()
      /home/levi/go/pkg/mod/gopkg.in/check.v1@v1.0.0-20201130134442-10cb98267c6c/run.go:92 +0x49
  gopkg.in/check%2ev1.RunAll()
      /home/levi/go/pkg/mod/gopkg.in/check.v1@v1.0.0-20201130134442-10cb98267c6c/run.go:84 +0x127
  gopkg.in/check%2ev1.TestingT()
      /home/levi/go/pkg/mod/gopkg.in/check.v1@v1.0.0-20201130134442-10cb98267c6c/run.go:72 +0x57a
  github.com/go-git/go-git/v5/storage/transactional.Test()
      /home/levi/go/src/github.com/fluxcd/go-git/storage/transactional/storage_test.go:17 +0x2e
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1446 +0x216
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1493 +0x47

Goroutine 151 (running) created at:
  github.com/go-git/go-git/v5/storage/filesystem/dotgit.newPackWrite()
      /home/levi/go/src/github.com/fluxcd/go-git/storage/filesystem/dotgit/writers.go:53 +0x4fa
  github.com/go-git/go-git/v5/storage/filesystem/dotgit.(*DotGit).NewObjectPack()
      /home/levi/go/src/github.com/fluxcd/go-git/storage/filesystem/dotgit/dotgit.go:209 +0xc5
  github.com/go-git/go-git/v5/storage/filesystem.(*ObjectStorage).PackfileWriter()
      /home/levi/go/src/github.com/fluxcd/go-git/storage/filesystem/object.go:103 +0x5a
  github.com/go-git/go-git/v5/storage/filesystem.(*Storage).PackfileWriter()
      <autogenerated>:1 +0x3b
  github.com/go-git/go-git/v5/storage/transactional.(*packageWriter).PackfileWriter()
      /home/levi/go/src/github.com/fluxcd/go-git/storage/transactional/storage.go:99 +0x4a
  github.com/go-git/go-git/v5/storage/test.(*BaseStorageSuite).TestPackfileWriter()
      /home/levi/go/src/github.com/fluxcd/go-git/storage/test/storage_suite.go:157 +0xb3
  github.com/go-git/go-git/v5/storage/transactional.(*StorageSuite).TestPackfileWriter()
      <autogenerated>:1 +0x44
  runtime.call16()
      /usr/local/go/src/runtime/asm_amd64.s:724 +0x48
  reflect.Value.Call()
      /usr/local/go/src/reflect/value.go:368 +0xc7
  gopkg.in/check%2ev1.(*suiteRunner).forkTest.func1()
      /home/levi/go/pkg/mod/gopkg.in/check.v1@v1.0.0-20201130134442-10cb98267c6c/check.go:775 +0xad4
  gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
      /home/levi/go/pkg/mod/gopkg.in/check.v1@v1.0.0-20201130134442-10cb98267c6c/check.go:669 +0xec
==================
OK: 56 passed, 11 skipped
--- FAIL: Test (0.08s)
    testing.go:1319: race detected during execution of test
FAIL
FAIL    github.com/go-git/go-git/v5/storage/transactional       0.08

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions