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

Intermittent crash indicates concurrent map writes #44

Closed
wagoodman opened this issue Oct 27, 2018 · 3 comments
Closed

Intermittent crash indicates concurrent map writes #44

wagoodman opened this issue Oct 27, 2018 · 3 comments
Labels
bug Something isn't working
Milestone

Comments

@wagoodman
Copy link
Owner

wagoodman commented Oct 27, 2018

Images with more layers sometimes show this:

    ├─ 5e7ef813d8d0e74 : [========================================>] 100 % (6/6)fatal error: concurrent map writes
    ├─ 51b6e1d4f41395e : [========================================>] 100 % (2/2)
goroutine 54 [running]:: loading...
runtime.throw(0x97e2db, 0x15)=====================================>] 100 % (133/133)
    ├─ 2/usr/lib/golang/src/runtime/panic.go:616 +0x81 fp=0xc420397c28 sp=0xc420397c08 pc=0x42b131
runtime.mapassign_faststr(0x8da9e0, 0xc42037c750, 0xc4276ee230, 0x4a, 0x54)(20/20)
    ├─ 2/usr/lib/golang/src/runtime/hashmap_fast.go:703 +0x3e9 fp=0xc420397c98 sp=0xc420397c28 pc=0x40d2e9
github.com/wagoodman/dive/image.processLayerTar(0xc4284e72c0, 0xc42037c750, 0xc4276ee230, 0x4a, 0xc428958000, 0x1600, 0x1600)
    ├─ 1/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:192 +0x559 fp=0xc420397fa8 sp=0xc420397c98 pc=0x78f509
runtime.goexit()b00266 : loading...
    ├─ 0/usr/lib/golang/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc420397fb0 sp=0xc420397fa8 pc=0x457331
created by github.com/wagoodman/dive/image.InitializeData
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:280 +0x953

goroutine 1 [syscall]:
syscall.Syscall(0x0, 0x7, 0xc428a7e000, 0x40ee400, 0xc420000180, 0xc424d62040, 0x20)
	/usr/lib/golang/src/syscall/asm_linux_amd64.s:18 +0x5
syscall.read(0x7, 0xc428a7e000, 0x40ee400, 0x40ee400, 0xc424d62001, 0x0, 0x0)
	/usr/lib/golang/src/syscall/zsyscall_linux_amd64.go:749 +0x5f
syscall.Read(0x7, 0xc428a7e000, 0x40ee400, 0x40ee400, 0x0, 0x0, 0x43cbac)
	/usr/lib/golang/src/syscall/syscall_unix.go:162 +0x49
internal/poll.(*FD).Read(0xc4203ce190, 0xc428a7e000, 0x40ee400, 0x40ee400, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/internal/poll/fd_unix.go:153 +0x118
os.(*File).read(0xc42000e088, 0xc428a7e000, 0x40ee400, 0x40ee400, 0x0, 0xc4276b3700, 0x419a14)
	/usr/lib/golang/src/os/file_unix.go:226 +0x4e
os.(*File).Read(0xc42000e088, 0xc428a7e000, 0x40ee400, 0x40ee400, 0x10100c4276b3750, 0x0, 0x40ee400)
	/usr/lib/golang/src/os/file.go:107 +0x6a
archive/tar.(*regFileReader).Read(0xc4289143e0, 0xc428a7e000, 0x40ee400, 0x40ee400, 0xc4276b3758, 0xc4276b37d0, 0x440ef7)
	/usr/lib/golang/src/archive/tar/reader.go:662 +0x177
archive/tar.(*Reader).Read(0xc420434000, 0xc428a7e000, 0x40ee400, 0x40ee400, 0x40ee400, 0x40ee400, 0x0)
	/usr/lib/golang/src/archive/tar/reader.go:623 +0x7c
github.com/wagoodman/dive/image.InitializeData(0x7fffc22eb880, 0x1a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:275 +0x88a
github.com/wagoodman/dive/cmd.analyze(0xc49000, 0xc4202ddbd0, 0x1, 0x1)
	/home/wagoodman/go/src/github.com/wagoodman/dive/cmd/analyze.go:35 +0xf9
github.com/spf13/cobra.(*Command).execute(0xc49000, 0xc4200c4010, 0x1, 0x1, 0xc49000, 0xc4200c4010)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:766 +0x2c1
github.com/spf13/cobra.(*Command).ExecuteC(0xc49000, 0x2, 0x7fcf3137b6c8, 0x0)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:852 +0x30a
github.com/spf13/cobra.(*Command).Execute(0xc49000, 0xc4201fbf78, 0xc4201fbf58)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:800 +0x2b
github.com/wagoodman/dive/cmd.Execute()
	/home/wagoodman/go/src/github.com/wagoodman/dive/cmd/root.go:29 +0x2d
main.main()
	/home/wagoodman/go/src/github.com/wagoodman/dive/main.go:38 +0xad

goroutine 19 [syscall]:
os/signal.signal_recv(0x0)
	/usr/lib/golang/src/runtime/sigqueue.go:139 +0xa6
os/signal.loop()
	/usr/lib/golang/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.0
	/usr/lib/golang/src/os/signal/signal_unix.go:28 +0x41

goroutine 20 [chan receive]:
github.com/wagoodman/jotframe.pollSignals()
	/home/wagoodman/go/src/github.com/wagoodman/jotframe/signal.go:38 +0x81
created by github.com/wagoodman/jotframe.init.0
	/home/wagoodman/go/src/github.com/wagoodman/jotframe/root.go:17 +0x51

goroutine 4 [select, locked to thread]:
runtime.gopark(0x9982e0, 0x0, 0x9751f5, 0x6, 0x18, 0x1)
	/usr/lib/golang/src/runtime/proc.go:291 +0x11a
runtime.selectgo(0xc42005d750, 0xc420036180)
	/usr/lib/golang/src/runtime/select.go:392 +0xe50
runtime.ensureSigM.func1()
	/usr/lib/golang/src/runtime/signal_unix.go:549 +0x1f4
runtime.goexit()
	/usr/lib/golang/src/runtime/asm_amd64.s:2361 +0x1

goroutine 23 [IO wait]:
internal/poll.runtime_pollWait(0x7fcf3132ff00, 0x72, 0xc4203989a8)
	/usr/lib/golang/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc420386018, 0x72, 0xffffffffffffff00, 0x9d88e0, 0xc0f5b8)
	/usr/lib/golang/src/internal/poll/fd_poll_runtime.go:85 +0x9b
internal/poll.(*pollDesc).waitRead(0xc420386018, 0xc420335000, 0x1000, 0x1000)
	/usr/lib/golang/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc420386000, 0xc420335000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/internal/poll/fd_unix.go:157 +0x17d
net.(*netFD).Read(0xc420386000, 0xc420335000, 0x1000, 0x1000, 0x453220, 0xc420000180, 0x4)
	/usr/lib/golang/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc4200be460, 0xc420335000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/net/net.go:176 +0x6a
net/http.(*persistConn).Read(0xc4200d9320, 0xc420335000, 0x1000, 0x1000, 0xc420398b98, 0x4051c5, 0xc42039c000)
	/usr/lib/golang/src/net/http/transport.go:1453 +0x136
bufio.(*Reader).fill(0xc4202a4f00)
	/usr/lib/golang/src/bufio/bufio.go:100 +0x11e
bufio.(*Reader).Peek(0xc4202a4f00, 0x1, 0x0, 0x0, 0x0, 0xc4200a6600, 0x0)
	/usr/lib/golang/src/bufio/bufio.go:132 +0x3a
net/http.(*persistConn).readLoop(0xc4200d9320)
	/usr/lib/golang/src/net/http/transport.go:1601 +0x185
created by net/http.(*Transport).dialConn
	/usr/lib/golang/src/net/http/transport.go:1237 +0x95a

goroutine 24 [select]:
net/http.(*persistConn).writeLoop(0xc4200d9320)
	/usr/lib/golang/src/net/http/transport.go:1822 +0x14b
created by net/http.(*Transport).dialConn
	/usr/lib/golang/src/net/http/transport.go:1238 +0x97f

goroutine 7 [IO wait]:
internal/poll.runtime_pollWait(0x7fcf3132fe30, 0x72, 0xc4200709a8)
	/usr/lib/golang/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc4203c8318, 0x72, 0xffffffffffffff00, 0x9d88e0, 0xc0f5b8)
	/usr/lib/golang/src/internal/poll/fd_poll_runtime.go:85 +0x9b
internal/poll.(*pollDesc).waitRead(0xc4203c8318, 0xc4203da000, 0x1000, 0x1000)
	/usr/lib/golang/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc4203c8300, 0xc4203da000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/internal/poll/fd_unix.go:157 +0x17d
net.(*netFD).Read(0xc4203c8300, 0xc4203da000, 0x1000, 0x1000, 0x453220, 0xc420000180, 0x4)
	/usr/lib/golang/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc42000e070, 0xc4203da000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/net/net.go:176 +0x6a
net/http.(*persistConn).Read(0xc4203c05a0, 0xc4203da000, 0x1000, 0x1000, 0xc420070b98, 0x4051c5, 0xc4200365a0)
	/usr/lib/golang/src/net/http/transport.go:1453 +0x136
bufio.(*Reader).fill(0xc42008e6c0)
	/usr/lib/golang/src/bufio/bufio.go:100 +0x11e
bufio.(*Reader).Peek(0xc42008e6c0, 0x1, 0x0, 0x0, 0x0, 0xc42039c120, 0x0)
	/usr/lib/golang/src/bufio/bufio.go:132 +0x3a
net/http.(*persistConn).readLoop(0xc4203c05a0)
	/usr/lib/golang/src/net/http/transport.go:1601 +0x185
created by net/http.(*Transport).dialConn
	/usr/lib/golang/src/net/http/transport.go:1237 +0x95a

goroutine 8 [select]:
net/http.(*persistConn).writeLoop(0xc4203c05a0)
	/usr/lib/golang/src/net/http/transport.go:1822 +0x14b
created by net/http.(*Transport).dialConn
	/usr/lib/golang/src/net/http/transport.go:1238 +0x97f

goroutine 50 [runnable]:
archive/tar.(*Reader).handleRegularFile(...)
	/usr/lib/golang/src/archive/tar/reader.go:173
archive/tar.(*Reader).next(0xc420106000, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/archive/tar/reader.go:82 +0x839
archive/tar.(*Reader).Next(0xc420106000, 0xc42899e2a0, 0xc428658990, 0xc)
	/usr/lib/golang/src/archive/tar/reader.go:52 +0x4e
github.com/wagoodman/dive/image.getFileList(0xc42047e000, 0x37c0400, 0x37c0400, 0x0, 0x0, 0x0)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:414 +0x193
github.com/wagoodman/dive/image.processLayerTar(0xc4203ce370, 0xc42037c750, 0xc42042cb90, 0x4a, 0xc42047e000, 0x37c0400, 0x37c0400)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:177 +0x98
created by github.com/wagoodman/dive/image.InitializeData
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:280 +0x953

goroutine 52 [runnable]:
archive/tar.(*Reader).Read(0xc424d6c240, 0xc42cbb4000, 0x1435a5, 0x1435a5, 0x1435a5, 0x1435a5, 0x30)
	/usr/lib/golang/src/archive/tar/reader.go:624 +0x119
github.com/wagoodman/dive/filetree.NewFileInfo(0xc424d6c240, 0xc427820d20, 0xc420036600, 0x57, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/wagoodman/go/src/github.com/wagoodman/dive/filetree/data.go:86 +0xc0
github.com/wagoodman/dive/image.getFileList(0xc424d94000, 0x2855600, 0x2855600, 0x0, 0x0, 0x0)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:433 +0x328
github.com/wagoodman/dive/image.processLayerTar(0xc420414320, 0xc42037c750, 0xc4201086e0, 0x4a, 0xc424d94000, 0x2855600, 0x2855600)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:177 +0x98
created by github.com/wagoodman/dive/image.InitializeData
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:280 +0x953

goroutine 98 [runnable]:
github.com/wagoodman/dive/image.processLayerTar(0xc428960050, 0xc42037c750, 0xc42042c0f0, 0x4a, 0xc428998000, 0xc00, 0xc00)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:192 +0x559
created by github.com/wagoodman/dive/image.InitializeData
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:280 +0x953
make: *** [Makefile:8: run] Error 2

This is within _, err = tarReader.Read(tarredBytes)

@wagoodman wagoodman added this to the v0.1.0 milestone Oct 27, 2018
@wagoodman wagoodman added the bug Something isn't working label Oct 29, 2018
@wagoodman wagoodman removed this from the v0.1.0 milestone Oct 29, 2018
@joshprice
Copy link

Saw this error on first usage

@ChrisCinelli
Copy link
Contributor

I think access to the layerMap in processLayerTar is the problem. It is not thread safe. You could fix it with a mutex or just eliminating concurrency. See #105 .

@ChrisCinelli
Copy link
Contributor

I wrote code with RWMutex to access layerMap similar to https://github.com/deckarep/sync-map-analysis/blob/master/regular.go but it is not necessary because #108 fixes this.

@wagoodman wagoodman added this to the v0.4.0 milestone Nov 29, 2018
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
None yet
Development

No branches or pull requests

3 participants