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

Race condition in TestUnshareOOMScoreAdj #2221

Open
hanwen-flow opened this issue Jan 22, 2025 · 0 comments
Open

Race condition in TestUnshareOOMScoreAdj #2221

hanwen-flow opened this issue Jan 22, 2025 · 0 comments

Comments

@hanwen-flow
Copy link
Contributor

this is with trivial renames applied on top of aef3f60

==================
WARNING: DATA RACE
Read at 0x00c000200228 by goroutine 15:
  bytes.(*Buffer).String()
      /usr/lib/go-1.22/src/bytes/buffer.go:71 +0x3a4
  github.com/containers/storage/pkg/unshare.TestUnshareOOMScoreAdj()
      /home/hanwen/vc/containers/storage/pkg/unshare/unshare_test.go:192 +0x397
  testing.tRunner()
      /usr/lib/go-1.22/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /usr/lib/go-1.22/src/testing/testing.go:1742 +0x44

Previous write at 0x00c000200228 by goroutine 16:
  bytes.(*Buffer).grow()
      /usr/lib/go-1.22/src/bytes/buffer.go:154 +0x3bd
  bytes.(*Buffer).ReadFrom()
      /usr/lib/go-1.22/src/bytes/buffer.go:209 +0x65
  io.copyBuffer()
      /usr/lib/go-1.22/src/io/io.go:415 +0x22e
  io.Copy()
      /usr/lib/go-1.22/src/io/io.go:388 +0x6f
  os.genericWriteTo()
      /usr/lib/go-1.22/src/os/file.go:269 +0x12
  os.(*File).WriteTo()
      /usr/lib/go-1.22/src/os/file.go:247 +0xd4
  io.copyBuffer()
      /usr/lib/go-1.22/src/io/io.go:411 +0xd3
  io.Copy()
      /usr/lib/go-1.22/src/io/io.go:388 +0x5a
  os/exec.(*Cmd).writerDescriptor.func1()
      /usr/lib/go-1.22/src/os/exec/exec.go:577 +0x37
  os/exec.(*Cmd).Start.func2()
      /usr/lib/go-1.22/src/os/exec/exec.go:724 +0x3c
  os/exec.(*Cmd).Start.gowrap1()
      /usr/lib/go-1.22/src/os/exec/exec.go:736 +0x41

Goroutine 15 (running) created at:
  testing.(*T).Run()
      /usr/lib/go-1.22/src/testing/testing.go:1742 +0x825
  testing.runTests.func1()
      /usr/lib/go-1.22/src/testing/testing.go:2161 +0x85
  testing.tRunner()
      /usr/lib/go-1.22/src/testing/testing.go:1689 +0x21e
  testing.runTests()
      /usr/lib/go-1.22/src/testing/testing.go:2159 +0x8be
  testing.(*M).Run()
      /usr/lib/go-1.22/src/testing/testing.go:2027 +0xf17
  github.com/containers/storage/pkg/unshare.TestMain()
      /home/hanwen/vc/containers/storage/pkg/unshare/unshare_test.go:24 +0xe4
  main.main()
      _testmain.go:57 +0x2d4

Goroutine 16 (running) created at:
  os/exec.(*Cmd).Start()
      /usr/lib/go-1.22/src/os/exec/exec.go:723 +0x11c4
  github.com/containers/storage/pkg/unshare.(*Cmd).Start()
      /home/hanwen/vc/containers/storage/pkg/unshare/unshare_linux.go:165 +0x1a96
  github.com/containers/storage/pkg/unshare.(*Cmd).Run()
      /home/hanwen/vc/containers/storage/pkg/unshare/unshare_linux.go:364 +0x26
  github.com/containers/storage/pkg/unshare.TestUnshareOOMScoreAdj()
      /home/hanwen/vc/containers/storage/pkg/unshare/unshare_test.go:190 +0x364
  testing.tRunner()
      /usr/lib/go-1.22/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /usr/lib/go-1.22/src/testing/testing.go:1742 +0x44
==================
==================
WARNING: DATA RACE
Read at 0x00c000200210 by goroutine 15:
  bytes.(*Buffer).String()
      /usr/lib/go-1.22/src/bytes/buffer.go:71 +0x3ba
  github.com/containers/storage/pkg/unshare.TestUnshareOOMScoreAdj()
      /home/hanwen/vc/containers/storage/pkg/unshare/unshare_test.go:192 +0x397
  testing.tRunner()
      /usr/lib/go-1.22/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /usr/lib/go-1.22/src/testing/testing.go:1742 +0x44

Previous write at 0x00c000200210 by goroutine 16:
  bytes.(*Buffer).grow()
      /usr/lib/go-1.22/src/bytes/buffer.go:151 +0x2d3
  bytes.(*Buffer).ReadFrom()
      /usr/lib/go-1.22/src/bytes/buffer.go:209 +0x65
  io.copyBuffer()
      /usr/lib/go-1.22/src/io/io.go:415 +0x22e
  io.Copy()
      /usr/lib/go-1.22/src/io/io.go:388 +0x6f
  os.genericWriteTo()
      /usr/lib/go-1.22/src/os/file.go:269 +0x12
  os.(*File).WriteTo()
      /usr/lib/go-1.22/src/os/file.go:247 +0xd4
  io.copyBuffer()
      /usr/lib/go-1.22/src/io/io.go:411 +0xd3
  io.Copy()
      /usr/lib/go-1.22/src/io/io.go:388 +0x5a
  os/exec.(*Cmd).writerDescriptor.func1()
      /usr/lib/go-1.22/src/os/exec/exec.go:577 +0x37
  os/exec.(*Cmd).Start.func2()
      /usr/lib/go-1.22/src/os/exec/exec.go:724 +0x3c
  os/exec.(*Cmd).Start.gowrap1()
      /usr/lib/go-1.22/src/os/exec/exec.go:736 +0x41

Goroutine 15 (running) created at:
  testing.(*T).Run()
      /usr/lib/go-1.22/src/testing/testing.go:1742 +0x825
  testing.runTests.func1()
      /usr/lib/go-1.22/src/testing/testing.go:2161 +0x85
  testing.tRunner()
      /usr/lib/go-1.22/src/testing/testing.go:1689 +0x21e
  testing.runTests()
      /usr/lib/go-1.22/src/testing/testing.go:2159 +0x8be
  testing.(*M).Run()
      /usr/lib/go-1.22/src/testing/testing.go:2027 +0xf17
  github.com/containers/storage/pkg/unshare.TestMain()
      /home/hanwen/vc/containers/storage/pkg/unshare/unshare_test.go:24 +0xe4
  main.main()
      _testmain.go:57 +0x2d4

Goroutine 16 (running) created at:
  os/exec.(*Cmd).Start()
      /usr/lib/go-1.22/src/os/exec/exec.go:723 +0x11c4
  github.com/containers/storage/pkg/unshare.(*Cmd).Start()
      /home/hanwen/vc/containers/storage/pkg/unshare/unshare_linux.go:165 +0x1a96
  github.com/containers/storage/pkg/unshare.(*Cmd).Run()
      /home/hanwen/vc/containers/storage/pkg/unshare/unshare_linux.go:364 +0x26
  github.com/containers/storage/pkg/unshare.TestUnshareOOMScoreAdj()
      /home/hanwen/vc/containers/storage/pkg/unshare/unshare_test.go:190 +0x364
  testing.tRunner()
      /usr/lib/go-1.22/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /usr/lib/go-1.22/src/testing/testing.go:1742 +0x44
==================
--- FAIL: TestUnshareOOMScoreAdj (0.00s)
    unshare_test.go:192: run: writing "824633803720" to /proc/501754/oom_score_adj: write /proc/501754/oom_score_adj: permission denied: 
    testing.go:1398: race detected during execution of test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant