Data race in termdash
nakabonne opened this issue · 0 comments
nakabonne commented
What's happened
Whenever we do:
- running with
-race
option - Attack with
Enter
- Quit with
Ctrl-C
A data race has been detected as shown below:
go run -race main.go http://host.xz
==================
WARNING: DATA RACE
Write at 0x00c00013c5b0 by main goroutine:
internal/poll.(*FD).destroy()
/usr/local/Cellar/go/1.15.1/libexec/src/internal/poll/fd_unix.go:78 +0xc4
internal/poll.(*FD).decref()
/usr/local/Cellar/go/1.15.1/libexec/src/internal/poll/fd_mutex.go:213 +0x53
internal/poll.(*FD).Close()
/usr/local/Cellar/go/1.15.1/libexec/src/internal/poll/fd_unix.go:99 +0x79
os.(*file).close()
/usr/local/Cellar/go/1.15.1/libexec/src/os/file_unix.go:235 +0x76
os.(*File).Close()
/usr/local/Cellar/go/1.15.1/libexec/src/os/file_posix.go:25 +0x567
github.com/nsf/termbox-go.Close()
/Users/nakabonne/go/pkg/mod/github.com/nsf/termbox-go@v0.0.0-20200204031403-4d2b513ad8be/api.go:142 +0x525
github.com/mum4k/termdash/terminal/termbox.(*Terminal).Close()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/terminal/termbox/termbox.go:163 +0x55
github.com/nakabonne/ali/gui.Run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x230
main.(*cli).run()
/Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
main.main()
/Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
Previous read at 0x00c00013c5b0 by goroutine 18:
[failed to restore the stack]
Goroutine 18 (running) created at:
github.com/mum4k/termdash/private/event.newSubscriber()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:89 +0x3cf
github.com/mum4k/termdash/private/event.(*DistributionSystem).Subscribe()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:237 +0x224
github.com/mum4k/termdash.(*termdash).subscribers()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:226 +0x4ce
github.com/mum4k/termdash.newTermdash()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:206 +0x2ec
github.com/mum4k/termdash.Run()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:106 +0x7a
github.com/nakabonne/ali/gui.run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:70 +0xa38
github.com/nakabonne/ali/gui.Run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x215
main.(*cli).run()
/Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
main.main()
/Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
==================
==================
WARNING: DATA RACE
Write at 0x0000018accf0 by main goroutine:
github.com/nsf/termbox-go.Close()
/Users/nakabonne/go/pkg/mod/github.com/nsf/termbox-go@v0.0.0-20200204031403-4d2b513ad8be/api.go:146 +0x597
github.com/mum4k/termdash/terminal/termbox.(*Terminal).Close()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/terminal/termbox/termbox.go:163 +0x55
github.com/nakabonne/ali/gui.Run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x230
main.(*cli).run()
/Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
main.main()
/Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
Previous read at 0x0000018accf0 by goroutine 18:
[failed to restore the stack]
Goroutine 18 (running) created at:
github.com/mum4k/termdash/private/event.newSubscriber()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:89 +0x3cf
github.com/mum4k/termdash/private/event.(*DistributionSystem).Subscribe()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:237 +0x224
github.com/mum4k/termdash.(*termdash).subscribers()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:226 +0x4ce
github.com/mum4k/termdash.newTermdash()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:206 +0x2ec
github.com/mum4k/termdash.Run()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:106 +0x7a
github.com/nakabonne/ali/gui.run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:70 +0xa38
github.com/nakabonne/ali/gui.Run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x215
main.(*cli).run()
/Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
main.main()
/Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
==================
==================
WARNING: DATA RACE
Write at 0x0000018acce8 by main goroutine:
github.com/nsf/termbox-go.Close()
/Users/nakabonne/go/pkg/mod/github.com/nsf/termbox-go@v0.0.0-20200204031403-4d2b513ad8be/api.go:147 +0x5b2
github.com/mum4k/termdash/terminal/termbox.(*Terminal).Close()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/terminal/termbox/termbox.go:163 +0x55
github.com/nakabonne/ali/gui.Run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x230
main.(*cli).run()
/Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
main.main()
/Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
Previous read at 0x0000018acce8 by goroutine 18:
[failed to restore the stack]
Goroutine 18 (running) created at:
github.com/mum4k/termdash/private/event.newSubscriber()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:89 +0x3cf
github.com/mum4k/termdash/private/event.(*DistributionSystem).Subscribe()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:237 +0x224
github.com/mum4k/termdash.(*termdash).subscribers()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:226 +0x4ce
github.com/mum4k/termdash.newTermdash()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:206 +0x2ec
github.com/mum4k/termdash.Run()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:106 +0x7a
github.com/nakabonne/ali/gui.run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:70 +0xa38
github.com/nakabonne/ali/gui.Run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x215
main.(*cli).run()
/Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
main.main()
/Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
==================
==================
WARNING: DATA RACE
Write at 0x000001879530 by main goroutine:
github.com/nsf/termbox-go.Close()
/Users/nakabonne/go/pkg/mod/github.com/nsf/termbox-go@v0.0.0-20200204031403-4d2b513ad8be/api.go:149 +0x5e8
github.com/mum4k/termdash/terminal/termbox.(*Terminal).Close()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/terminal/termbox/termbox.go:163 +0x55
github.com/nakabonne/ali/gui.Run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x230
main.(*cli).run()
/Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
main.main()
/Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
Previous read at 0x000001879530 by goroutine 18:
[failed to restore the stack]
Goroutine 18 (running) created at:
github.com/mum4k/termdash/private/event.newSubscriber()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:89 +0x3cf
github.com/mum4k/termdash/private/event.(*DistributionSystem).Subscribe()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:237 +0x224
github.com/mum4k/termdash.(*termdash).subscribers()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:226 +0x4ce
github.com/mum4k/termdash.newTermdash()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:206 +0x2ec
github.com/mum4k/termdash.Run()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:106 +0x7a
github.com/nakabonne/ali/gui.run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:70 +0xa38
github.com/nakabonne/ali/gui.Run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x215
main.(*cli).run()
/Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
main.main()
/Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
==================
==================
WARNING: DATA RACE
Write at 0x0000018207b8 by main goroutine:
github.com/nsf/termbox-go.Close()
/Users/nakabonne/go/pkg/mod/github.com/nsf/termbox-go@v0.0.0-20200204031403-4d2b513ad8be/api.go:153 +0x65d
github.com/mum4k/termdash/terminal/termbox.(*Terminal).Close()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/terminal/termbox/termbox.go:163 +0x55
github.com/nakabonne/ali/gui.Run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x230
main.(*cli).run()
/Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
main.main()
/Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
Previous write at 0x0000018207b8 by goroutine 18:
[failed to restore the stack]
Goroutine 18 (running) created at:
github.com/mum4k/termdash/private/event.newSubscriber()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:89 +0x3cf
github.com/mum4k/termdash/private/event.(*DistributionSystem).Subscribe()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:237 +0x224
github.com/mum4k/termdash.(*termdash).subscribers()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:226 +0x4ce
github.com/mum4k/termdash.newTermdash()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:206 +0x2ec
github.com/mum4k/termdash.Run()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:106 +0x7a
github.com/nakabonne/ali/gui.run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:70 +0xa38
github.com/nakabonne/ali/gui.Run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x215
main.(*cli).run()
/Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
main.main()
/Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
==================
==================
WARNING: DATA RACE
Write at 0x0000018207c0 by main goroutine:
github.com/nsf/termbox-go.Close()
/Users/nakabonne/go/pkg/mod/github.com/nsf/termbox-go@v0.0.0-20200204031403-4d2b513ad8be/api.go:154 +0x678
github.com/mum4k/termdash/terminal/termbox.(*Terminal).Close()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/terminal/termbox/termbox.go:163 +0x55
github.com/nakabonne/ali/gui.Run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x230
main.(*cli).run()
/Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
main.main()
/Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
Previous write at 0x0000018207c0 by goroutine 18:
[failed to restore the stack]
Goroutine 18 (running) created at:
github.com/mum4k/termdash/private/event.newSubscriber()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:89 +0x3cf
github.com/mum4k/termdash/private/event.(*DistributionSystem).Subscribe()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:237 +0x224
github.com/mum4k/termdash.(*termdash).subscribers()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:226 +0x4ce
github.com/mum4k/termdash.newTermdash()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:206 +0x2ec
github.com/mum4k/termdash.Run()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:106 +0x7a
github.com/nakabonne/ali/gui.run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:70 +0xa38
github.com/nakabonne/ali/gui.Run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x215
main.(*cli).run()
/Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
main.main()
/Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
==================
==================
WARNING: DATA RACE
Write at 0x0000018207a0 by main goroutine:
github.com/nsf/termbox-go.Close()
/Users/nakabonne/go/pkg/mod/github.com/nsf/termbox-go@v0.0.0-20200204031403-4d2b513ad8be/api.go:155 +0x693
github.com/mum4k/termdash/terminal/termbox.(*Terminal).Close()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/terminal/termbox/termbox.go:163 +0x55
github.com/nakabonne/ali/gui.Run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x230
main.(*cli).run()
/Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
main.main()
/Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
Previous read at 0x0000018207a0 by goroutine 18:
github.com/nsf/termbox-go.Flush()
/Users/nakabonne/go/pkg/mod/github.com/nsf/termbox-go@v0.0.0-20200204031403-4d2b513ad8be/api.go:208 +0x773
github.com/mum4k/termdash/terminal/termbox.(*Terminal).Flush()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/terminal/termbox/termbox.go:113 +0x2f
github.com/mum4k/termdash.(*termdash).redraw()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:278 +0x1bd
github.com/mum4k/termdash.(*termdash).evRedraw()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:294 +0xa6
github.com/mum4k/termdash.(*termdash).subscribers.func3()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:230 +0x44
github.com/mum4k/termdash/private/event.(*subscriber).callback()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:95 +0x5a
github.com/mum4k/termdash/private/event.(*subscriber).run()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:110 +0xd2
Goroutine 18 (running) created at:
github.com/mum4k/termdash/private/event.newSubscriber()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:89 +0x3cf
github.com/mum4k/termdash/private/event.(*DistributionSystem).Subscribe()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:237 +0x224
github.com/mum4k/termdash.(*termdash).subscribers()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:226 +0x4ce
github.com/mum4k/termdash.newTermdash()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:206 +0x2ec
github.com/mum4k/termdash.Run()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:106 +0x7a
github.com/nakabonne/ali/gui.run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:70 +0xa38
github.com/nakabonne/ali/gui.Run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x215
main.(*cli).run()
/Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
main.main()
/Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
==================
==================
WARNING: DATA RACE
Write at 0x0000018207a8 by main goroutine:
github.com/nsf/termbox-go.Close()
/Users/nakabonne/go/pkg/mod/github.com/nsf/termbox-go@v0.0.0-20200204031403-4d2b513ad8be/api.go:156 +0x6ae
github.com/mum4k/termdash/terminal/termbox.(*Terminal).Close()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/terminal/termbox/termbox.go:163 +0x55
github.com/nakabonne/ali/gui.Run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x230
main.(*cli).run()
/Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
main.main()
/Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
Previous read at 0x0000018207a8 by goroutine 18:
github.com/nsf/termbox-go.Flush()
/Users/nakabonne/go/pkg/mod/github.com/nsf/termbox-go@v0.0.0-20200204031403-4d2b513ad8be/api.go:208 +0x757
github.com/mum4k/termdash/terminal/termbox.(*Terminal).Flush()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/terminal/termbox/termbox.go:113 +0x2f
github.com/mum4k/termdash.(*termdash).redraw()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:278 +0x1bd
github.com/mum4k/termdash.(*termdash).evRedraw()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:294 +0xa6
github.com/mum4k/termdash.(*termdash).subscribers.func3()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:230 +0x44
github.com/mum4k/termdash/private/event.(*subscriber).callback()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:95 +0x5a
github.com/mum4k/termdash/private/event.(*subscriber).run()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:110 +0xd2
Goroutine 18 (running) created at:
github.com/mum4k/termdash/private/event.newSubscriber()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:89 +0x3cf
github.com/mum4k/termdash/private/event.(*DistributionSystem).Subscribe()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/private/event/event.go:237 +0x224
github.com/mum4k/termdash.(*termdash).subscribers()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:226 +0x4ce
github.com/mum4k/termdash.newTermdash()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:206 +0x2ec
github.com/mum4k/termdash.Run()
/Users/nakabonne/go/pkg/mod/github.com/mum4k/termdash@v0.12.2/termdash.go:106 +0x7a
github.com/nakabonne/ali/gui.run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:70 +0xa38
github.com/nakabonne/ali/gui.Run()
/Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x215
main.(*cli).run()
/Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
main.main()
/Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
==================
Found 8 data race(s)
exit status 66
reported at #66 (comment)