-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hight CPU usage - Socket never closed #123
Comments
Thanks.
Netstack had a bug re: forever UDP sockets which we upstreamed & sync'd back to firestack ( Unsure if There's a bug which we haven't been able to fix but it involves forever open TCP conns (and not UDP but over WireGuard). Or, it could also be a bug in our connection tracker that it may be tracking an already closed TCP connection.
Strange. We never noticed this, but we do occassionally get reports from users complaining about battery drains. If you can, please see if the CPU use goes away on the current tip (there's been some 600+ commits since). Also, on the current tip, from client code, you can:
Not really.
Possibly. |
Thanks for your answer @ignoramous
My implementation is the same as before with ee0a5ac. Can I find an example anywhere to compare what I'm supposed to change to use a DoT/DoH server now? |
Does firestack close a pair of net.Conn in one goroutine and guarantee that these two net.Conn are not closed until another forwarding goroutine stops? |
firestack needs a bootstrap DNS server if you don't pass IPs to |
How am I supposed to configure the bootstrap DNS server ? To me it was the point of calling |
I'm not sure how to answer you here. All I have is the following logs and a CPU trace. |
I think so. Lines 229 to 237 in dc54c93
Hm, I think golang requires clients to set rw deadlines on UDP sockets. May be that's keeping the conns up? Create a new default (bootstrap) DNS: Lines 63 to 66 in dc54c93
//dns53
intra.NewDefaultDNS(backend.DNS53, "1.1.1.2,8.8.4.4,9.9.9.10", "")
// doh
intra.NewDefaultDNS(backend.DOH, "https://dns.cloudflare-dns.com/dns-query", "1.0.0.1,1.1.1.1") Pass its ref to Line 69 in dc54c93
We aren't really paying attention to the APIs tbh. And so, if you want us to simplify/stabilize it or extensively document them, let us know! |
Deadlines are used to "generate" timeout errors to prevent infinite loops.
It seems not. firestack/intra/core/closer.go Line 147 in dc54c93
|
For full duplex TCP, it closes read on one end, write on the other. No way to do so for UDP?
True. Believe Line 38 in dc54c93
|
CPU usage seems to be under control with the latest version. I will keep a eye on it and let you know. |
Yes, but Line 76 in dc54c93
In my gvisor-playground, one of two goroutines ( there may be more goroutines in some cases ) checks a shared variable in addition to setting deadlines, and another goroutine stores "the time of last |
Hello,
It seems that the production version used in Rethink DNS (ee0a5ac) has an issue with sockets not being closed. After a day of use, the CPU usage reaches 50% even though no traffic is being generated. When we extract the processes, it appears that this usage originates from the GO code in Firestack.
If we release the library, a large number (+100) of socket closure logs are generated:
onSocketClosed: SocketSummary{Proto:udp,ID:13d815e967215ae5,PID:Base,UID:-1,Target:192.0.2.255,Rx:0,Tx:983224,Duration:5979,Rtt:0,Msg:read udp 192.0.2.1:53449->192.0.2.255:32761: use of closed network connection,Dup:true,}
The library is configured as follows in our project:
Are we supposed to monitor and close some socket ourself? is it a bug in the library?
Thanks in advance for your support.
The text was updated successfully, but these errors were encountered: