pytogo / portforward

Kubernetes Port-Forward Go-Edition For Python
https://portforward.readthedocs.io
MIT License
17 stars 6 forks source link

Portforward crashes intermittently when portforwarding to same port repeatedly #17

Closed drawal1 closed 1 year ago

drawal1 commented 1 year ago

Description

Running a pytest. portforward crashes intermittently. portforward crashes every time with exact same callstack signature if you manually bind the port before-hand so the port is already in use

What I Did

Ran a pytest that repeatedly uses portforward with the same port over and over. Saw intermittent crash when rerunning pytest
Manually forward port. Now portforward crashes EVERY TIME with exact same call stack. So..., port forward needs to check if port is already in use and wait OR abort displaying a proper error saying port is already in use 

Callstack with portforward tries to forward to a port already in use:
  File "/home/.../miniconda3/envs/sunshine/lib/python3.10/site-packages/portforward.py", line 92 in forward
  File "/home/.../miniconda3/envs/sunshine/lib/python3.10/contextlib.py", line 135 in __enter__
corka149 commented 1 year ago

Hi @drawal1

the old behavior was to panic. I changed it and also test whether the port is available. The release for 0.4.3 will be today.