functionland / go-fula

Client-server stack for Web3! Turn your Raspberry Pi to a BAS server in minutes and enjoy the freedom of decentralized Web with a superior user experience!
MIT License
13 stars 6 forks source link

Resource Limit Exceeds #219

Open ehsan6sha opened 8 months ago

ehsan6sha commented 8 months ago

On mobile, it seems when doing push (and maybe it is the same for pull but not yet shown), it seems the opened streams are not closed properly and kept open as it show the following error in the middle of upload, no matter how low we set the rate limiter (even as low as 5, it just postpones the error):

Failed to send push request     {"err": "Post \"libp2p://12D3KooWD3nNJtfNgRWhZf6FgFhrq8H7NBhziPAZpqzK1RycjgBt/push/bafyr4ihjzf4mbigxn75iavbdvtw7co6thcry6rncswanrvdjra5xtzf3ha\": failed to open stream: stream-3570: transient: cannot reserve outbound stream: resource limit exceeded"}

In the error htere is mention to stream number 3570 and it increases on the first fail. So it increases the number and continu giving hte same error after it first fails on around 3400

The issue is probably around this part: https://github.com/functionland/go-fula/blob/d80361fbe7373278908e6688f34894f6cd674a02/exchange/fx_exchange.go#L447

I tried adding a circuit breaker to it and also removing the resource manager on mobile to temporarily resolve this but it is not a long term solution and I suspect we will have the same issue with pull too