Closed VladyslavLukyanenko closed 1 year ago
Hi @VladyslavLukyanenko, thanks for reporting the bug. Could you provide a minimum reproducible code?
Hi @VladyslavLukyanenko, thanks for reporting the bug. Could you provide a minimum reproducible code?
Clone wishlist, run it using go run -race . serve
there's a lot of race conditions but this one happens upon shutting the server down/exiting it
Note: you need to connect to the server and then it happens, launching it and closing it won't trigger it
Could you test this with these branches https://github.com/muesli/termenv/pull/146 https://github.com/charmbracelet/lipgloss/pull/210?
so the other data races are completely gone, thanks for that, but this one still persists.
==================
WARNING: DATA RACE
Write at 0x00c0002fc200 by goroutine 18:
runtime.slicecopy()
/opt/homebrew/opt/go/libexec/src/runtime/slice.go:310 +0x0
bytes.(*Buffer).WriteString()
/opt/homebrew/opt/go/libexec/src/bytes/buffer.go:184 +0x108
github.com/charmbracelet/log.(*Logger).textFormatter()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/text.go:152 +0x26c
github.com/charmbracelet/log.(*Logger).log()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/logger.go:107 +0xc9c
github.com/charmbracelet/log.(*Logger).Info()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/logger.go:310 +0x434
github.com/charmbracelet/log.(*stdLogWriter).Write()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/stdlog.go:41 +0x384
log.(*Logger).Output()
/opt/homebrew/opt/go/libexec/src/log/log.go:194 +0x344
log.(*Logger).Printf()
/opt/homebrew/opt/go/libexec/src/log/log.go:204 +0x84
github.com/charmbracelet/wish/logging.MiddlewareWithLogger.func1.1()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/wish@v1.1.1/logging/logging.go:47 +0x4c0
github.com/charmbracelet/wish/activeterm.Middleware.func1.1()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/wish@v1.1.1/activeterm/activeterm.go:21 +0x54
github.com/charmbracelet/ssh.(*session).handleRequests.func1()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/ssh@v0.0.0-20221117183211-483d43d97103/session.go:259 +0x4c
Previous read at 0x00c0002fc200 by main goroutine:
runtime.racereadrange()
<autogenerated>:1 +0x14
internal/poll.ignoringEINTRIO()
/opt/homebrew/opt/go/libexec/src/internal/poll/fd_unix.go:794 +0x39c
internal/poll.(*FD).Write()
/opt/homebrew/opt/go/libexec/src/internal/poll/fd_unix.go:383 +0x1ec
os.(*File).write()
/opt/homebrew/opt/go/libexec/src/os/file_posix.go:48 +0x90
os.(*File).Write()
/opt/homebrew/opt/go/libexec/src/os/file.go:175 +0x70
github.com/charmbracelet/log.(*Logger).log()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/logger.go:110 +0xd48
github.com/charmbracelet/log.Info()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/pkg.go:157 +0xc8c
github.com/charmbracelet/wishlist.Serve()
/Users/vlad/TestArea/wishlist/server.go:93 +0xc50
main.glob..func4()
/Users/vlad/TestArea/wishlist/cmd/wishlist/main.go:189 +0x584
github.com/spf13/cobra.(*Command).execute()
/Users/vlad/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x7cc
github.com/spf13/cobra.(*Command).ExecuteC()
/Users/vlad/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x48c
github.com/spf13/cobra.(*Command).Execute()
/Users/vlad/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 +0x158
main.main()
/Users/vlad/TestArea/wishlist/cmd/wishlist/main.go:230 +0x140
Goroutine 18 (running) created at:
github.com/charmbracelet/ssh.(*session).handleRequests()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/ssh@v0.0.0-20221117183211-483d43d97103/session.go:258 +0x62c
github.com/charmbracelet/ssh.DefaultSessionHandler()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/ssh@v0.0.0-20221117183211-483d43d97103/session.go:106 +0x2d8
github.com/charmbracelet/ssh.(*Server).HandleConn.func4()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/ssh@v0.0.0-20221117183211-483d43d97103/server.go:305 +0x84
==================
==================
WARNING: DATA RACE
Write at 0x00c0002fc213 by goroutine 18:
bytes.(*Buffer).WriteByte()
/opt/homebrew/opt/go/libexec/src/bytes/buffer.go:282 +0xe0
github.com/charmbracelet/log.(*Logger).textFormatter()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/text.go:153 +0x278
github.com/charmbracelet/log.(*Logger).log()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/logger.go:107 +0xc9c
github.com/charmbracelet/log.(*Logger).Info()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/logger.go:310 +0x434
github.com/charmbracelet/log.(*stdLogWriter).Write()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/stdlog.go:41 +0x384
log.(*Logger).Output()
/opt/homebrew/opt/go/libexec/src/log/log.go:194 +0x344
log.(*Logger).Printf()
/opt/homebrew/opt/go/libexec/src/log/log.go:204 +0x84
github.com/charmbracelet/wish/logging.MiddlewareWithLogger.func1.1()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/wish@v1.1.1/logging/logging.go:47 +0x4c0
github.com/charmbracelet/wish/activeterm.Middleware.func1.1()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/wish@v1.1.1/activeterm/activeterm.go:21 +0x54
github.com/charmbracelet/ssh.(*session).handleRequests.func1()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/ssh@v0.0.0-20221117183211-483d43d97103/session.go:259 +0x4c
Previous read at 0x00c0002fc210 by main goroutine:
runtime.racereadrange()
<autogenerated>:1 +0x14
internal/poll.ignoringEINTRIO()
/opt/homebrew/opt/go/libexec/src/internal/poll/fd_unix.go:794 +0x39c
internal/poll.(*FD).Write()
/opt/homebrew/opt/go/libexec/src/internal/poll/fd_unix.go:383 +0x1ec
os.(*File).write()
/opt/homebrew/opt/go/libexec/src/os/file_posix.go:48 +0x90
os.(*File).Write()
/opt/homebrew/opt/go/libexec/src/os/file.go:175 +0x70
github.com/charmbracelet/log.(*Logger).log()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/logger.go:110 +0xd48
github.com/charmbracelet/log.Info()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/pkg.go:157 +0xc8c
github.com/charmbracelet/wishlist.Serve()
/Users/vlad/TestArea/wishlist/server.go:93 +0xc50
main.glob..func4()
/Users/vlad/TestArea/wishlist/cmd/wishlist/main.go:189 +0x584
github.com/spf13/cobra.(*Command).execute()
/Users/vlad/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x7cc
github.com/spf13/cobra.(*Command).ExecuteC()
/Users/vlad/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x48c
github.com/spf13/cobra.(*Command).Execute()
/Users/vlad/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 +0x158
main.main()
/Users/vlad/TestArea/wishlist/cmd/wishlist/main.go:230 +0x140
Goroutine 18 (running) created at:
github.com/charmbracelet/ssh.(*session).handleRequests()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/ssh@v0.0.0-20221117183211-483d43d97103/session.go:258 +0x62c
github.com/charmbracelet/ssh.DefaultSessionHandler()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/ssh@v0.0.0-20221117183211-483d43d97103/session.go:106 +0x2d8
github.com/charmbracelet/ssh.(*Server).HandleConn.func4()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/ssh@v0.0.0-20221117183211-483d43d97103/server.go:305 +0x84
==================
==================
WARNING: DATA RACE
Write at 0x00c0002fc228 by goroutine 18:
bytes.(*Buffer).WriteByte()
/opt/homebrew/opt/go/libexec/src/bytes/buffer.go:282 +0xe0
github.com/charmbracelet/log.(*Logger).textFormatter()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/text.go:159 +0x500
github.com/charmbracelet/log.(*Logger).log()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/logger.go:107 +0xc9c
github.com/charmbracelet/log.(*Logger).Info()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/logger.go:310 +0x434
github.com/charmbracelet/log.(*stdLogWriter).Write()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/stdlog.go:41 +0x384
log.(*Logger).Output()
/opt/homebrew/opt/go/libexec/src/log/log.go:194 +0x344
log.(*Logger).Printf()
/opt/homebrew/opt/go/libexec/src/log/log.go:204 +0x84
github.com/charmbracelet/wish/logging.MiddlewareWithLogger.func1.1()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/wish@v1.1.1/logging/logging.go:47 +0x4c0
github.com/charmbracelet/wish/activeterm.Middleware.func1.1()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/wish@v1.1.1/activeterm/activeterm.go:21 +0x54
github.com/charmbracelet/ssh.(*session).handleRequests.func1()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/ssh@v0.0.0-20221117183211-483d43d97103/session.go:259 +0x4c
Previous read at 0x00c0002fc228 by main goroutine:
runtime.racereadrange()
<autogenerated>:1 +0x14
internal/poll.ignoringEINTRIO()
/opt/homebrew/opt/go/libexec/src/internal/poll/fd_unix.go:794 +0x39c
internal/poll.(*FD).Write()
/opt/homebrew/opt/go/libexec/src/internal/poll/fd_unix.go:383 +0x1ec
os.(*File).write()
/opt/homebrew/opt/go/libexec/src/os/file_posix.go:48 +0x90
os.(*File).Write()
/opt/homebrew/opt/go/libexec/src/os/file.go:175 +0x70
github.com/charmbracelet/log.(*Logger).log()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/logger.go:110 +0xd48
github.com/charmbracelet/log.Info()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/log@v0.2.2/pkg.go:157 +0xc8c
github.com/charmbracelet/wishlist.Serve()
/Users/vlad/TestArea/wishlist/server.go:93 +0xc50
main.glob..func4()
/Users/vlad/TestArea/wishlist/cmd/wishlist/main.go:189 +0x584
github.com/spf13/cobra.(*Command).execute()
/Users/vlad/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x7cc
github.com/spf13/cobra.(*Command).ExecuteC()
/Users/vlad/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x48c
github.com/spf13/cobra.(*Command).Execute()
/Users/vlad/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 +0x158
main.main()
/Users/vlad/TestArea/wishlist/cmd/wishlist/main.go:230 +0x140
Goroutine 18 (running) created at:
github.com/charmbracelet/ssh.(*session).handleRequests()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/ssh@v0.0.0-20221117183211-483d43d97103/session.go:258 +0x62c
github.com/charmbracelet/ssh.DefaultSessionHandler()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/ssh@v0.0.0-20221117183211-483d43d97103/session.go:106 +0x2d8
github.com/charmbracelet/ssh.(*Server).HandleConn.func4()
/Users/vlad/go/pkg/mod/github.com/charmbracelet/ssh@v0.0.0-20221117183211-483d43d97103/server.go:305 +0x84
==================
This data race happens upon shutting down wishlist server.