Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests fail using Go 1.19 because of data race #79

Closed
rdpsin opened this issue Sep 27, 2022 · 1 comment
Closed

Unit tests fail using Go 1.19 because of data race #79

rdpsin opened this issue Sep 27, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@rdpsin
Copy link
Contributor

rdpsin commented Sep 27, 2022

Describe the bug
The unit tests inside the soci/ directory fail due a data race. This only happens when using Go 1.19.x, not the previous versions of Go.

Steps To Reproduce

$ go version
go version go1.19 linux/amd64

$ make test 
...
==================
WARNING: DATA RACE
Write at 0x00c001509038 by goroutine 55:
  runtime.racewriterange()
      <autogenerated>:1 +0x29
  internal/poll.(*FD).Pread()
      /usr/local/go/src/internal/poll/fd_unix.go:193 +0x169
  os.(*File).pread()
      /usr/local/go/src/os/file_posix.go:40 +0x335
  os.(*File).ReadAt()
      /usr/local/go/src/os/file.go:136 +0x2de
  io.(*SectionReader).ReadAt()
      /usr/local/go/src/io/io.go:552 +0x205
  github.com/awslabs/soci-snapshotter/soci.ExtractFile.func1()
      /home/ec2-user/soci-snapshotter/soci/ztoc.go:141 +0x1db
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      /home/ec2-user/go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:57 +0x91

Previous write at 0x00c001509039 by goroutine 56:
  runtime.racewriterange()
      <autogenerated>:1 +0x29
  internal/poll.(*FD).Pread()
      /usr/local/go/src/internal/poll/fd_unix.go:193 +0x169
  os.(*File).pread()
      /usr/local/go/src/os/file_posix.go:40 +0x335
  os.(*File).ReadAt()
      /usr/local/go/src/os/file.go:136 +0x2de
  io.(*SectionReader).ReadAt()
      /usr/local/go/src/io/io.go:552 +0x205
  github.com/awslabs/soci-snapshotter/soci.ExtractFile.func1()
      /home/ec2-user/soci-snapshotter/soci/ztoc.go:141 +0x1db
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      /home/ec2-user/go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:57 +0x91

Goroutine 55 (running) created at:
  golang.org/x/sync/errgroup.(*Group).Go()
      /home/ec2-user/go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:54 +0xee
  github.com/awslabs/soci-snapshotter/soci.ExtractFile()
      /home/ec2-user/soci-snapshotter/soci/ztoc.go:135 +0x6eb
  github.com/awslabs/soci-snapshotter/soci.TestDecompress()
      /home/ec2-user/soci-snapshotter/soci/ztoc_test.go:138 +0xf88
  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 56 (running) created at:
  golang.org/x/sync/errgroup.(*Group).Go()
      /home/ec2-user/go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:54 +0xee
  github.com/awslabs/soci-snapshotter/soci.ExtractFile()
      /home/ec2-user/soci-snapshotter/soci/ztoc.go:135 +0x6eb
  github.com/awslabs/soci-snapshotter/soci.TestDecompress()
      /home/ec2-user/soci-snapshotter/soci/ztoc_test.go:138 +0xf88
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1446 +0x216
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1493 +0x47
==================
--- FAIL: TestDecompress (12.08s)
    testing.go:1319: race detected during execution of test

Expected behavior
All unit tests pass.

Configuration (please complete the following information):

  • OS: AL2 (Linux 5.10.130-118.517.amzn2.x86_64)
  • Snapshotter Version: c5a2474
  • Containerd Version: v1.6.6
  • Go Version: go version go1.19 linux/amd64
@rdpsin rdpsin added the bug Something isn't working label Sep 27, 2022
@vkuzniet
Copy link
Contributor

vkuzniet commented Oct 3, 2022

Fixed with #88

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants