Skip to content

GoRoutines hanging around even after program exits #15

@ritwick5ghosh

Description

@ritwick5ghosh

I just added a panic as the last line of the example code provided and got the following...looks like there might be a few goroutines hanging around - is there any way we can close them out before existing main?

panic: Test

goroutine 1 [running]:
main.main()
/Users/rghosh/Go/src/dummy/ssh.go:27 +0x2c5

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1696 +0x1

goroutine 5 [IO wait]:
net.runtime_pollWait(0x4b05f8, 0x72, 0xc82000a190)
/usr/local/go/src/runtime/netpoll.go:157 +0x60
net.(_pollDesc).Wait(0xc8200b0300, 0x72, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(_pollDesc).WaitRead(0xc8200b0300, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(_netFD).Read(0xc8200b02a0, 0xc820019000, 0x1000, 0x1000, 0x0, 0x4ab050, 0xc82000a190)
/usr/local/go/src/net/fd_unix.go:232 +0x23a
net.(_conn).Read(0xc820030030, 0xc820019000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:172 +0xe4
bufio.(_Reader).fill(0xc8200b3620)
/usr/local/go/src/bufio/bufio.go:97 +0x1e9
bufio.(_Reader).Read(0xc8200b3620, 0xc8200dc1a0, 0x5, 0x5, 0x14, 0x0, 0x0)
/usr/local/go/src/bufio/bufio.go:207 +0x260
io.ReadAtLeast(0x4b0890, 0xc8200b3620, 0xc8200dc1a0, 0x5, 0x5, 0x5, 0x0, 0x0, 0x0)
/usr/local/go/src/io/io.go:298 +0xe6
io.ReadFull(0x4b0890, 0xc8200b3620, 0xc8200dc1a0, 0x5, 0x5, 0xc8200da950, 0x0, 0x0)
/usr/local/go/src/io/io.go:316 +0x62
golang.org/x/crypto/ssh.(_streamPacketCipher).readPacket(0xc8200dc180, 0xc80000000e, 0x4b0890, 0xc8200b3620, 0x0, 0x0, 0x0, 0x0, 0x0)
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/cipher.go:142 +0xc1
golang.org/x/crypto/ssh.(_connectionState).readPacket(0xc820080900, 0xc8200b3620, 0x0, 0x0, 0x0, 0x0, 0x0)
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/transport.go:111 +0xce
golang.org/x/crypto/ssh.(_transport).readPacket(0xc820080900, 0x0, 0x0, 0x0, 0x0, 0x0)
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/transport.go:107 +0x55
golang.org/x/crypto/ssh.(_handshakeTransport).readOnePacket(0xc820080a20, 0x0, 0x0, 0x0, 0x0, 0x0)
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/handshake.go:173 +0xe7
golang.org/x/crypto/ssh.(*handshakeTransport).readLoop(0xc820080a20)
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/handshake.go:145 +0x25
created by golang.org/x/crypto/ssh.newClientTransport
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/handshake.go:113 +0x37d

goroutine 18 [chan receive]:
golang.org/x/crypto/ssh.(_handshakeTransport).readPacket(0xc820080a20, 0x0, 0x0, 0x0, 0x0, 0x0)
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/handshake.go:136 +0x6d
golang.org/x/crypto/ssh.(_mux).onePacket(0xc82021acb0, 0x0, 0x0)
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/mux.go:224 +0x5e
golang.org/x/crypto/ssh.(*mux).loop(0xc82021acb0)
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/mux.go:199 +0x42
created by golang.org/x/crypto/ssh.newMux
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/mux.go:128 +0x20d

goroutine 19 [chan receive]:
golang.org/x/crypto/ssh.(*Client).handleGlobalRequests(0xc82022e0c0, 0xc820230060)
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/client.go:137 +0x4a
created by golang.org/x/crypto/ssh.NewClient
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/client.go:54 +0xe4

goroutine 20 [chan receive]:
golang.org/x/crypto/ssh.(*Client).handleChannelOpens(0xc82022e0c0, 0xc82021df80)
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/client.go:146 +0x6e
created by golang.org/x/crypto/ssh.NewClient
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/client.go:55 +0x110

goroutine 21 [semacquire]:
sync.runtime_Syncsemacquire(0xc82022e090)
/usr/local/go/src/runtime/sema.go:237 +0x201
sync.(_Cond).Wait(0xc82022e080)
/usr/local/go/src/sync/cond.go:62 +0x9b
golang.org/x/crypto/ssh.(_mux).Wait(0xc82021acb0, 0x0, 0x0)
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/mux.go:110 +0xb8
golang.org/x/crypto/ssh.NewClient.func1(0xc82022e0c0)
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/client.go:57 +0x39
created by golang.org/x/crypto/ssh.NewClient
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/client.go:59 +0x132

goroutine 22 [chan receive]:
golang.org/x/crypto/ssh.(*forwardList).handleChannels(0xc82022e0d0, 0xc8202300c0)
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/tcpip.go:178 +0x6e
created by golang.org/x/crypto/ssh.NewClient
/Users/rghosh/Go/src/golang.org/x/crypto/ssh/client.go:60 +0x18f
exit status 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions