You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func (s*sshRelay) handleChannels(ctx context.Context, chans<-chan ssh.NewChannel) {
// Service the incoming Channel channel in go routinehandleChannelWg:=&sync.WaitGroup{}
deferhandleChannelWg.Wait()
for {
select {
case<-ctx.Done():
returncasenewChannel:=<-chans:
ifnewChannel==nil {
s.log.Info("nil value from channel")
continue
}
handleChannelWg.Add(1)
gos.handleChannel(ctx, handleChannelWg, newChannel)
}
}
}
What did you expect to see?
chan should not return nil values. The example in crypto/ssh/example_test also does not check for nil
What did you see instead?
Even if the ssh session is closed from the client side, the channel is still served with nil's
Not sure if I consume something wrong and the garbage collector is supposed to cleanup the channel, but if I terminate the client ssh session the log looks like the following:
{"level":"info","msg":"nil value from channel"}
{"level":"info","msg":"nil value from channel"}
{"level":"info","msg":"nil value from channel"}
{"level":"info","msg":"nil value from channel"}
....
{"level":"info","msg":"nil value from channel"}
{"level":"info","msg":"nil value from channel"}
The text was updated successfully, but these errors were encountered:
A receive operation on a closed channel can always proceed immediately, yielding the element type's zero value after any previously sent values have been received.
The example ends on channel close.
I believe this is working as intended.
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
chan should not return nil values. The example in
crypto/ssh/example_test
also does not check fornil
What did you see instead?
Even if the ssh session is closed from the client side, the channel is still served with
nil
'sNot sure if I consume something wrong and the garbage collector is supposed to cleanup the channel, but if I terminate the client ssh session the log looks like the following:
The text was updated successfully, but these errors were encountered: