Hi, I have weird issue with TCP session stuck on device after command's execution through api.cmd_session context manager.
For example, I execute "show clock" on device:
Feb 18 14:45:04 gnetcliserver server[11611]: {"level":"debug","ts":1739889904.8476634,"msg":"executed","cmd_login":"netai","cmd_host":"grb-olf01.n.mws-infra.net","cmd":"host:\"grb-olf01.n.mws-infra.net\" cmd:\"show clock\" host_params:{device:\"bcomos\"}","duration":0.000034933}
Feb 18 14:45:04 gnetcliserver server[11611]: {"level":"info","ts":1739889904.8613896,"caller":"zap/options.go:212","msg":"finished streaming call with code OK","grpc.start_time":"2025-02-18T14:45:04Z","system":"grpc","span.kind":"server","grpc.service":"gnetcli.Gnetcli","grpc.method":"ExecChat","grpc.code":"OK","grpc.time_ms":498.454}
So, command has been executed on the host, but I still can see gnetcli username on device
Line User Idle Location/Session PID TYPE Role
130 vty 0 [C]robonoc 0d00h02m pts/0 16669 Local network-admin
(*) 131 vty 1 [C]anteron 0d00h00m pts/1 16720 Local network-admin
So, if I decide to specify "exit" in commands list in explicit manner, I got this one:
Feb 18 14:52:34 gnetcliserver server[11611]: {"level":"debug","ts":1739890354.8231742,"msg":"sessionStdoutReader error","cmd_login":"netai","cmd_host":"grb-olf01.n.mws-infra.net","error":"EOF"}
"grpc.service":"gnetcli.Gnetcli","grpc.method":"ExecChat","error":"rpc error: code = Internal desc = read timeout error. last seen: \"\"","grpc.code":"Internal","grpc.time_ms":613.389,"stacktrace":"github.com/grpc-ecosystem/go-grpc-middleware/logging/zap.DefaultMessageProducer\n\t/home/anteron/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.4.0/logging/zap/options.go:212\ngithub.com/grpc-ecosystem/go-grpc-middleware/logging/zap.StreamServerInterceptor.func1\n\t/home/anteron/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.4.0/logging/zap/server_interceptors.go:61\nmain.main.ChainStreamServer.func9\n\t/home/anteron/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.4.0/chain.go:86\ngoogle.golang.org/grpc.(*Server).processStreamingRPC\n\t/home/anteron/go/pkg/mod/google.golang.org/grpc@v1.58.2/server.go:1677\ngoogle.golang.org/grpc.(*Server).handleStream\n\t/home/anteron/go/pkg/mod/google.golang.org/grpc@v1.58.2/server.go:1757\ngoogle.golang.org/grpc.(*Server).serveStreams.func1.1\n\t/home/anteron/go/pkg/mod/google.golang.org/grpc@v1.58.2/server.go:998"}
It seems no proper way to close session on device?
Hi, I have weird issue with TCP session stuck on device after command's execution through api.cmd_session context manager.
For example, I execute "show clock" on device:
So, command has been executed on the host, but I still can see gnetcli username on device
So, if I decide to specify "exit" in commands list in explicit manner, I got this one:
It seems no proper way to close session on device?