readline icon indicating copy to clipboard operation
readline copied to clipboard

build example in windows, run: fatal error: all goroutines are asleep - deadlock!

Open winxxp opened this issue 9 years ago • 6 comments

build example in windows, run: fatal error: all goroutines are asleep - deadlock!

OS: win7 64 Go: 1.5.2

winxxp avatar Dec 09 '15 08:12 winxxp

Hi~ Which demo did you build? readline-demo? Did you run it directly without modify anything? Would you provide the stack of deadlock? I can't reproduce that.

chzyer avatar Dec 09 '15 08:12 chzyer

  • example: readline-demo
  • terminal: msys2, worked ok in windows default terminal(DOS)
$ go run readline-demo.go
» fatal error: all goroutines are asleep - deadlock!

goroutine 1 [select]:
github.com/chzyer/readline.(*Operation).Runes(0xc0820184e0, 0x0, 0x0, 0x0, 0x0, 0x0)
        D:/golib/src/github.com/chzyer/readline/operation.go:298 +0x2dc
github.com/chzyer/readline.(*Operation).String(0xc0820184e0, 0x0, 0x0, 0x0, 0x0)
        D:/golib/src/github.com/chzyer/readline/operation.go:282 +0x47
github.com/chzyer/readline.(*Instance).Readline(0xc082008980, 0x0, 0x0, 0x0, 0x0)
        D:/golib/src/github.com/chzyer/readline/readline.go:144 +0x44
main.main()
        D:/golib/src/github.com/chzyer/readline/example/readline-demo/readline-demo.go:67 +0x53e

goroutine 5 [chan receive]:
github.com/chzyer/readline.(*ANSIWriter).ioloop(0xc08205e240)
        D:/golib/src/github.com/chzyer/readline/ansi_windows.go:101 +0x1a2
created by github.com/chzyer/readline.NewANSIWriter
        D:/golib/src/github.com/chzyer/readline/ansi_windows.go:64 +0xc7

goroutine 6 [chan receive]:
github.com/chzyer/readline.(*ANSIWriter).ioloop(0xc08205e270)
        D:/golib/src/github.com/chzyer/readline/ansi_windows.go:101 +0x1a2
created by github.com/chzyer/readline.NewANSIWriter
        D:/golib/src/github.com/chzyer/readline/ansi_windows.go:64 +0xc7

goroutine 8 [chan receive]:
github.com/chzyer/readline.(*Operation).ioloop(0xc0820184e0)
        D:/golib/src/github.com/chzyer/readline/operation.go:87 +0x6a
created by github.com/chzyer/readline.NewOperation
        D:/golib/src/github.com/chzyer/readline/operation.go:71 +0x556
exit status 2

winxxp avatar Dec 09 '15 10:12 winxxp

Thanks for catching that. I will try to reproduce and fix it

chzyer avatar Dec 16 '15 13:12 chzyer

Very odd - ran into exactly the same bug today, Win7 (someone else's machine). There was also a serial port involved, the problem "went away" when we switched from a Prolific PL2303 USB serial port to another brand - but now I'm starting to suspect that this bug may just have moved around a little - possibly due to a timing difference.

jcw avatar Mar 29 '16 23:03 jcw

I have the same exact problem, I think, on Windows 7.

go-hash» fatal error: all goroutines are asleep - deadlock!

goroutine 1 [select]:
github.com/chzyer/readline.(*Operation).Runes(0xc042090150, 0x0, 0x0, 0x0, 0x0,
0x0)
        C:/Users/Renato/go/src/github.com/chzyer/readline/operation.go:390 +0x20
f
github.com/chzyer/readline.(*Operation).String(0xc042090150, 0x5036da, 0xc042090
150, 0xc0420583a0, 0x13)
        C:/Users/Renato/go/src/github.com/chzyer/readline/operation.go:375 +0x32

github.com/chzyer/readline.(*Instance).Readline(0xc042050e00, 0xc0420583a0, 0x13
, 0x65d401, 0xc042046030)
        C:/Users/Renato/go/src/github.com/chzyer/readline/readline.go:255 +0x36
main.runCliLoop(0xc04207a4e8, 0xc0420581a0, 0x18, 0xc04205a460, 0x9)
        C:/Users/Renato/go/src/github.com/renatoathaydes/go-hash/main.go:141 +0x
3b0
main.main()
        C:/Users/Renato/go/src/github.com/renatoathaydes/go-hash/main.go:237 +0x
28e

goroutine 18 [select]:
github.com/chzyer/readline.(*CancelableStdin).ioloop(0xc0420c20c0)
        C:/Users/Renato/go/src/github.com/chzyer/readline/std.go:93 +0xf1
created by github.com/chzyer/readline.NewCancelableStdin
        C:/Users/Renato/go/src/github.com/chzyer/readline/std.go:86 +0xee

goroutine 19 [semacquire]:
sync.runtime_notifyListWait(0xc0420c8100, 0xc000000000)
        C:/Go/src/runtime/sema.go:507 +0x11e
sync.(*Cond).Wait(0xc0420c80f0)
        C:/Go/src/sync/cond.go:56 +0x87
io.(*pipe).read(0xc0420c80c0, 0xc04203a070, 0x64, 0x64, 0x0, 0x0, 0x0)
        C:/Go/src/io/pipe.go:47 +0xcd
io.(*PipeReader).Read(0xc04207a508, 0xc04203a070, 0x64, 0x64, 0x64, 0x64, 0x0)
        C:/Go/src/io/pipe.go:130 +0x53
github.com/chzyer/readline.(*FillableStdin).ioloop.func1(0xc0420981e0)
        C:/Users/Renato/go/src/github.com/chzyer/readline/std.go:161 +0x9a
created by github.com/chzyer/readline.(*FillableStdin).ioloop
        C:/Users/Renato/go/src/github.com/chzyer/readline/std.go:157 +0x46

On my code, all I did was line, err := cli.Readline().

This only happens in Windows (not sure which versions, I only have 7 here).

renatoathaydes avatar Jan 03 '18 19:01 renatoathaydes

I was using the cmd.exe terminal. This error happens every time, it's deterministic.

Go version: go version go1.9.2 windows/amd64. Readline version:

[[projects]]
  name = "github.com/chzyer/readline"
  packages = ["."]
  revision = "62c6fe6193755f722b8b8788aa7357be55a50ff1"
  version = "v1.4"

renatoathaydes avatar Jan 03 '18 19:01 renatoathaydes