Open kormachevt opened 3 months ago
I've added some logs to my vendored package version and observed, that only the first call to "Close()" is handled.
Looks like module level var once sync.Once
prevents subsequent calls, even though new port-forward instances are created (and they all run successfully).
As a workaround I've moved it to to the top of forwarders func, then all my port-forward were successfully closed on defer.
This is probably just a hack, but works for me for now.
Hi ! I have the following question/issue: go panics
panic: lost connection to pod
even after port-forwards were closed.Here is simplified code I use. The
main
function actually is executed in Go routine (it is some e2e tests running in k8s)It all works great, in logs after this particular test is concluded I see
However down the road, long after all ports were supposedly closed, in the next tests Go panics with
In my initial implementation I was calling
Close()
on each iteration manually (not throughdefer
), but on the second iteration port from the first one was still in use somehow, so I resorted to use separate port in each iteration. Now I tried withdefer
and ports are closed on return (as they should) , but still this issue persists.Any thoughts will be appreciated.