Commit ea0b54c
committed
tarfs: fix a data race condition
WARNING: DATA RACE
Write at 0x00c000178428 by goroutine 27:
github.com/containerd/nydus-snapshotter/pkg/remote/remotes/docker.(*httpReadSeeker).Close()
/home/runner/work/nydus-snapshotter/nydus-snapshotter/pkg/remote/remotes/docker/httpreadseeker.go:87 +0x57
github.com/containerd/nydus-snapshotter/pkg/tarfs.(*Manager).blobProcess.func2.1()
/home/runner/work/nydus-snapshotter/nydus-snapshotter/pkg/tarfs/tarfs.go:339 +0x48
runtime.deferreturn()
/opt/hostedtoolcache/go/1.20.1/x64/src/runtime/panic.go:476 +0x32
github.com/containerd/nydus-snapshotter/pkg/tarfs.(*Manager).blobProcess.func3()
/home/runner/work/nydus-snapshotter/nydus-snapshotter/pkg/tarfs/tarfs.go:394 +0x71
Previous read at 0x00c000178428 by goroutine 40:
github.com/containerd/nydus-snapshotter/pkg/remote/remotes/docker.(*httpReadSeeker).Read()
/home/runner/work/nydus-snapshotter/nydus-snapshotter/pkg/remote/remotes/docker/httpreadseeker.go:48 +0x68
bufio.(*Reader).Read()
/opt/hostedtoolcache/go/1.20.1/x64/src/bufio/bufio.go:223 +0x2c3
github.com/containerd/containerd/archive/compression.(*bufferedReader).Read()
/home/runner/go/pkg/mod/github.com/containerd/[email protected]/archive/compression/compression.go:113 +0xa4
io.copyBuffer()
/opt/hostedtoolcache/go/1.20.1/x64/src/io/io.go:427 +0x28d
io.Copy()
/opt/hostedtoolcache/go/1.20.1/x64/src/io/io.go:386 +0x88
os.genericReadFrom()
/opt/hostedtoolcache/go/1.20.1/x64/src/os/file.go:161 +0x34
os.(*File).ReadFrom()
/opt/hostedtoolcache/go/1.20.1/x64/src/os/file.go:155 +0x324
io.copyBuffer()
/opt/hostedtoolcache/go/1.20.1/x64/src/io/io.go:413 +0x1c5
io.Copy()
/opt/hostedtoolcache/go/1.20.1/x64/src/io/io.go:386 +0x84
os/exec.(*Cmd).childStdin.func1()
/opt/hostedtoolcache/go/1.20.1/x64/src/os/exec/exec.go:511 +0x45
os/exec.(*Cmd).Start.func2()
/opt/hostedtoolcache/go/1.20.1/x64/src/os/exec/exec.go:717 +0x42
os/exec.(*Cmd).Start.func3()
/opt/hostedtoolcache/go/1.20.1/x64/src/os/exec/exec.go:729 +0x47
Goroutine 27 (running) created at:
github.com/containerd/nydus-snapshotter/pkg/tarfs.(*Manager).blobProcess()
/home/runner/work/nydus-snapshotter/nydus-snapshotter/pkg/tarfs/tarfs.go:393 +0x9dd
github.com/containerd/nydus-snapshotter/pkg/tarfs.(*Manager).PrepareLayer()
/home/runner/work/nydus-snapshotter/nydus-snapshotter/pkg/tarfs/tarfs.go:465 +0x444
github.com/containerd/nydus-snapshotter/pkg/tarfs.TestPrepareLayer()
/home/runner/work/nydus-snapshotter/nydus-snapshotter/pkg/tarfs/tarfs_test.go:33 +0x188
testing.tRunner()
/opt/hostedtoolcache/go/1.20.1/x64/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/opt/hostedtoolcache/go/1.20.1/x64/src/testing/testing.go:1629 +0x47
Goroutine 40 (finished) created at:
os/exec.(*Cmd).Start()
/opt/hostedtoolcache/go/1.20.1/x64/src/os/exec/exec.go:716 +0xf8e
github.com/containerd/containerd/archive/compression.cmdStream()
/home/runner/go/pkg/mod/github.com/containerd/[email protected]/archive/compression/compression.go:284 +0x36f
github.com/containerd/containerd/archive/compression.gzipDecompress()
/home/runner/go/pkg/mod/github.com/containerd/[email protected]/archive/compression/compression.go:272 +0x152
github.com/containerd/containerd/archive/compression.DecompressStream()
/home/runner/go/pkg/mod/github.com/containerd/[email protected]/archive/compression/compression.go:203 +0x3e4
github.com/containerd/nydus-snapshotter/pkg/tarfs.(*Manager).blobProcess.func2()
/home/runner/work/nydus-snapshotter/nydus-snapshotter/pkg/tarfs/tarfs.go:341 +0x1b1
github.com/containerd/nydus-snapshotter/pkg/tarfs.(*Manager).blobProcess.func3()
/home/runner/work/nydus-snapshotter/nydus-snapshotter/pkg/tarfs/tarfs.go:394 +0x71
==================
testing.go:1446: race detected during execution of test
Signed-off-by: Jiang Liu <[email protected]>1 parent f0323b2 commit ea0b54c
2 files changed
+18
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
397 | 400 | | |
398 | 401 | | |
399 | 402 | | |
| |||
999 | 1002 | | |
1000 | 1003 | | |
1001 | 1004 | | |
1002 | | - | |
| 1005 | + | |
1003 | 1006 | | |
1004 | 1007 | | |
1005 | 1008 | | |
1006 | 1009 | | |
1007 | 1010 | | |
1008 | 1011 | | |
1009 | 1012 | | |
1010 | | - | |
| 1013 | + | |
1011 | 1014 | | |
1012 | 1015 | | |
1013 | 1016 | | |
| |||
1021 | 1024 | | |
1022 | 1025 | | |
1023 | 1026 | | |
1024 | | - | |
| 1027 | + | |
| 1028 | + | |
1025 | 1029 | | |
1026 | 1030 | | |
1027 | 1031 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
0 commit comments