Closed
Description
There are 2 bugs in tunnel_service.py
:
super().stop_tunnel
should be called after closing _sock_read_task
but before closing the writer
.This is the proper order to stop these because of their dependency on each other. It will prevent warning logs in
tun_read_task
Don't use
aiofiles
to read from the tun. Just read normally (with asyncio.to_thread
).The problem here is that using a context manager on the raw file descriptor actually closes it when this is not intended (it will be closed when the tun is closed). Also, this can cause rare file descriptor issues due to the socket being closed but python not aware of it, so when the OS reuses the same fd some later time python will complain it's already in use. It happened to me a couple of times and this solves it.
Metadata
Metadata
Assignees
Labels
No labels