cryptosharks131 / lndg

Lite GUI web interface to analyze lnd data and leverage the backend database for automation tools around rebalancing and other basic maintenance tasks.
MIT License
219 stars 41 forks source link

Memory Leak? #366

Closed Heebron closed 1 week ago

Heebron commented 8 months ago

I noticed that when I run lndg, I see the following in my lnd logs:

2024-01-18 22:06:18.871 [WRN] SRVR: Already have 38 persistent connection requests for 02f9695db875da0f1e732eeb1b3e8361ccecee2ecb2807f645bdbdf52086f05998@109.224.84.149:9735, connecting anyway.
2024-01-18 22:06:18.872 [WRN] SRVR: Already have 39 persistent connection requests for 02f9695db875da0f1e732eeb1b3e8361ccecee2ecb2807f645bdbdf52086f05998@10.1.2.2:45066, connecting anyway.
2024-01-18 22:06:18.918 [WRN] SRVR: Already have 5965 persistent connection requests for 02ff12b70f1095ce240e109d108c39571d9a282b0e331d46e89a752db69a22ed13@llmq46jmwztvzb7ewty2qbwoz7wrqsbuqwode7yedrkp5esaurg5yeid.onion:9735, connecting anyway.
2024-01-18 22:06:18.919 [WRN] SRVR: Already have 5966 persistent connection requests for 02ff12b70f1095ce240e109d108c39571d9a282b0e331d46e89a752db69a22ed13@10.1.2.2:64273, connecting anyway.
2024-01-18 22:06:18.954 [WRN] SRVR: Already have 8586 persistent connection requests for 032d4baebebfdeab7a2ecef2fbe109cbef10de95f05aa54090fdb687789547dbf5@212.51.129.46:9735, connecting anyway.
2024-01-18 22:06:18.955 [WRN] SRVR: Already have 8587 persistent connection requests for 032d4baebebfdeab7a2ecef2fbe109cbef10de95f05aa54090fdb687789547dbf5@10.1.2.2:54237, connecting anyway.
2024-01-18 22:06:18.995 [WRN] SRVR: Already have 8585 persistent connection requests for 03438c4ee1c0ee7f84084a4ed179bb19cd5b349c11a14e2c63bfda3ee9a36cf95f@oaffrqomsnw5hlxrvofdiq4a2qgy7x342672cvvgeo2oeayda42hdkid.onion:9735, connecting anyway.
2024-01-18 22:06:18.996 [WRN] SRVR: Already have 8586 persistent connection requests for 03438c4ee1c0ee7f84084a4ed179bb19cd5b349c11a14e2c63bfda3ee9a36cf95f@10.1.2.2:58533, connecting anyway.

I don't know for sure where the error lies. However, there seems to be two problems - lndg is connecting over and over again and lnd is not limiting the size of the array containing the attempts. This unbounded growth could lead to DoS. I also noticed that most of the nodes listed above are tor only nodes. I don't listen on tor.

I'll be digging into this once I have a moment - but thought I'd post here in the off chance you would immediately know the cause and the remedy. Thank you much for this FOSS work!

cryptosharks131 commented 8 months ago

This can occur when a peer is unreachable, since LNDg is asking LND to try a reconnection every 3 minutes when a channel is offline. It seems if LND takes longer than this to try a connection, then the requests start to pile up.