Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Remove or extend UDP listening timeout #109

Open
fortuna opened this issue Feb 1, 2023 · 1 comment · May be fixed by #110
Open

Remove or extend UDP listening timeout #109

fortuna opened this issue Feb 1, 2023 · 1 comment · May be fixed by #110

Comments

@fortuna
Copy link
Contributor

fortuna commented Feb 1, 2023

If a read hits the timeout, we stop listening for packets:

proxyConn.SetDeadline(time.Now().Add(h.timeout))
n, addr, err := proxyConn.ReadFrom(buf)
if err != nil {
return
}

I wonder if this is causing issues with apps that use UDP, specially in extreme conditions.

The default timeout is 30 seconds:

udpHandler = oss.NewUDPHandler(t.client, 30*time.Second)

It's not clear to me that we need the timeout. Tun2socks stack will supposedly call udpHandler.Close() when the app socket is closed.

My suggestion is to remove the timeout. At least make is longer, like the 5 minutes we use on the server:
https://github.com/Jigsaw-Code/outline-ss-server/blob/8269318bb6268f9de5b289c31a59da7617520ce8/server.go#L50-L51

fortuna added a commit that referenced this issue Feb 1, 2023
This may address some issues with UDP.
Fixes #109.
@fortuna fortuna linked a pull request Feb 1, 2023 that will close this issue
@bemasc
Copy link
Contributor

bemasc commented Feb 1, 2023

Tun2socks stack will supposedly call udpHandler.Close() when the app socket is closed.

No, tun2socks has no way to know whether the app socket has been closed. It only has access to the "tun device" as an io.ReadWriteCloser, with IP packets flowing in and out.

@maddyhof maddyhof added this to Server Issues in [DEPRECATED] Outline (Classic) Feb 6, 2023
@maddyhof maddyhof moved this from Server Issues to Manager Issues in [DEPRECATED] Outline (Classic) Feb 6, 2023
@maddyhof maddyhof changed the title UDP will stop listening after timeout Remove or extend UDP listening timeout Jul 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
[DEPRECATED] Outline (Classic)
Service Provider Issues
Development

Successfully merging a pull request may close this issue.

3 participants