kptdev/kpt

Race detected in unit test failure

johnbelamaric opened this issue · 1 comments

Expected behavior

No races.

Actual behavior

==================
WARNING: DATA RACE
Read at 0x00c000436270 by goroutine 10:
  [github.com/GoogleContainerTools/kpt/porch/pkg/git.(*gitPackageRevision).checkPublishedLifecycle()](http://github.com/GoogleContainerTools/kpt/porch/pkg/git.(*gitPackageRevision).checkPublishedLifecycle())
      /home/runner/work/kpt/kpt/porch/pkg/git/package.go:293 +0x6d
  [github.com/GoogleContainerTools/kpt/porch/pkg/git.(*gitPackageRevision).Lifecycle()](http://github.com/GoogleContainerTools/kpt/porch/pkg/git.(*gitPackageRevision).Lifecycle())
      /home/runner/work/kpt/kpt/porch/pkg/git/package.go:287 +0xc4
  [github.com/GoogleContainerTools/kpt/porch/pkg/git.(*gitPackageRevision).GetPackageRevision()](http://github.com/GoogleContainerTools/kpt/porch/pkg/git.(*gitPackageRevision).GetPackageRevision())
      /home/runner/work/kpt/kpt/porch/pkg/git/package.go:142 +0x5e5
  [github.com/GoogleContainerTools/kpt/porch/pkg/cache.(*cachedPackageRevision).GetPackageRevision()](http://github.com/GoogleContainerTools/kpt/porch/pkg/cache.(*cachedPackageRevision).GetPackageRevision())
      /home/runner/work/kpt/kpt/porch/pkg/cache/packagerevision.go:38 +0x58
  [github.com/GoogleContainerTools/kpt/porch/pkg/cache.TestLatestPackages()](http://github.com/GoogleContainerTools/kpt/porch/pkg/cache.TestLatestPackages())
      /home/runner/work/kpt/kpt/porch/pkg/cache/cache_test.go:57 +0x47d
  testing.tRunner()
      /opt/hostedtoolcache/go/1.20.4/x64/src/testing/testing.go:1576 +0x216
  testing.(*T).Run.func1()
      /opt/hostedtoolcache/go/1.20.4/x64/src/testing/testing.go:1629 +0x47

Previous write at 0x00c000436270 by goroutine 21:
  [github.com/GoogleContainerTools/kpt/porch/pkg/git.(*gitRepository).UpdateDeletionProposedCache()](http://github.com/GoogleContainerTools/kpt/porch/pkg/git.(*gitRepository).UpdateDeletionProposedCache())
      /home/runner/work/kpt/kpt/porch/pkg/git/git.go:636 +0xdd
  [github.com/GoogleContainerTools/kpt/porch/pkg/cache.(*cachedRepository).getCachedPackages()](http://github.com/GoogleContainerTools/kpt/porch/pkg/cache.(*cachedRepository).getCachedPackages())
      /home/runner/work/kpt/kpt/porch/pkg/cache/repository.go:155 +0xf2
  [github.com/GoogleContainerTools/kpt/porch/pkg/cache.(*cachedRepository).getPackageRevisions()](http://github.com/GoogleContainerTools/kpt/porch/pkg/cache.(*cachedRepository).getPackageRevisions())
      /home/runner/work/kpt/kpt/porch/pkg/cache/repository.go:120 +0xf7
  [github.com/GoogleContainerTools/kpt/porch/pkg/cache.(*cachedRepository).pollOnce()](http://github.com/GoogleContainerTools/kpt/porch/pkg/cache.(*cachedRepository).pollOnce())
      /home/runner/work/kpt/kpt/porch/pkg/cache/repository.go:360 +0x2e4
  [github.com/GoogleContainerTools/kpt/porch/pkg/cache.(*cachedRepository).pollForever()](http://github.com/GoogleContainerTools/kpt/porch/pkg/cache.(*cachedRepository).pollForever())
      /home/runner/work/kpt/kpt/porch/pkg/cache/repository.go:341 +0x67
  [github.com/GoogleContainerTools/kpt/porch/pkg/cache.newRepository.func1()](http://github.com/GoogleContainerTools/kpt/porch/pkg/cache.newRepository.func1())
      /home/runner/work/kpt/kpt/porch/pkg/cache/repository.go:84 +0x58

Goroutine 10 (running) created at:
  testing.(*T).Run()
      /opt/hostedtoolcache/go/1.20.4/x64/src/testing/testing.go:1629 +0x805
  testing.runTests.func1()
      /opt/hostedtoolcache/go/1.20.4/x64/src/testing/testing.go:2036 +0x8d
  testing.tRunner()
      /opt/hostedtoolcache/go/1.20.4/x64/src/testing/testing.go:1576 +0x216
  testing.runTests()
      /opt/hostedtoolcache/go/1.20.4/x64/src/testing/testing.go:2034 +0x87c
  testing.(*M).Run()
      /opt/hostedtoolcache/go/1.20.4/x64/src/testing/testing.go:1906 +0xb44
  main.main()
      _testmain.go:49 +0x2e9

Goroutine 21 (running) created at:
  [github.com/GoogleContainerTools/kpt/porch/pkg/cache.newRepository()](http://github.com/GoogleContainerTools/kpt/porch/pkg/cache.newRepository())
      /home/runner/work/kpt/kpt/porch/pkg/cache/repository.go:84 +0x354
  [github.com/GoogleContainerTools/kpt/porch/pkg/cache.(*Cache).OpenRepository()](http://github.com/GoogleContainerTools/kpt/porch/pkg/cache.(*Cache).OpenRepository())
      /home/runner/work/kpt/kpt/porch/pkg/cache/cache.go:140 +0x7fd
  [github.com/GoogleContainerTools/kpt/porch/pkg/cache.openRepositoryFromArchive()](http://github.com/GoogleContainerTools/kpt/porch/pkg/cache.openRepositoryFromArchive())
      /home/runner/work/kpt/kpt/porch/pkg/cache/cache_test.go:141 +0x909
  [github.com/GoogleContainerTools/kpt/porch/pkg/cache.TestLatestPackages()](http://github.com/GoogleContainerTools/kpt/porch/pkg/cache.TestLatestPackages())
      /home/runner/work/kpt/kpt/porch/pkg/cache/cache_test.go:41 +0x109
  testing.tRunner()
      /opt/hostedtoolcache/go/1.20.4/x64/src/testing/testing.go:1576 +0x216
  testing.(*T).Run.func1()
      /opt/hostedtoolcache/go/1.20.4/x64/src/testing/testing.go:1629 +0x47
==================

Information

https://github.com/GoogleContainerTools/kpt/actions/runs/4997123201/jobs/8951143322?pr=3957

This is fixed with #3984.