openziti / desktop-edge-win

Provides a Ziti client for Windows
Apache License 2.0
35 stars 13 forks source link

Tun write eof check #449

Closed mary-dcouto closed 2 years ago

mary-dcouto commented 2 years ago

There was a panic error while closing the tun interface, because the read loop exits when it receives the "file already closed" error, but the write loop does not exit gracefully. This is a race condition which occurs very rarely during the shutdown of the tunnel interface. So we need to handle the file closed error in the write loop as well. (These errors have been spotted in the logs of 3 of our NF employees and it happens very rarely)

Error message : An unexpected and unrecoverable error has occurred while writing to tun device: file already closed

Occasionally we see the tunnel hanging at the native tun close/remove function. This too is a rare scenario. So we added more logging to verify exactly where it is hanging. Redundant delete tun calls are removed