lightninglabs / lightning-app

An easy-to-use cross-platform Lightning wallet
GNU General Public License v3.0
901 stars 172 forks source link

Routes seem to be lost when app loses focus #948

Open bit-the-dust opened 5 years ago

bit-the-dust commented 5 years ago

Description

Routing failures tend to occur after the app has been idle for a while.

iOS 0.0.13

Steps to reproduce the behavior

Fund a wallet, create some channels and successfully make payments. Allow phone to auto lock, lay idle for a while. Get new invoices from vendors successfully paid previously. Attempt to make a payment.

Expected behavior

Find a route, successfully complete a payment.

Actual behavior

Route not found error, payment fails.

After failures such as this, I manually shut down the app, start again and make a payment it typically succeeds.

Screenshot and/or logs if applicable

tanx commented 5 years ago

I experienced the same behavior. Assuming this is also due to missing mobile optimization @Roasbeef ?

Roasbeef commented 5 years ago

It's likely the case that when the app comes back in re-focus, all our TCP connections are dead. We then need to re-establish them with each of our peers. There's a back off right now that's tuned for server deployments. It's likely the case that this back off needs to be set to a much much lower amount for the mobile so there isn't a 30 second period caused by an early back off.

weaklysubjective commented 5 years ago

@roasbeef - having experienced this in my app (uses 0.5.1-beta commit) and having looked similar mobile peer connectivity issues i made suggested changes - such as

Even so, under the following scenarios, connection is lost 1) LND is running, RPC is running, peers have no channel between them. Mobile user switches task from app to message someone or take a call - peer was disconnected. Incoming peer is not able to reconnect, only remote peer who initiated the connection in the first place is able reconnect. This happens repeatedly , 2) Sometimes even LND is dead (not listening on default port) when user switches tasks.

I have looked at similar LND issues all the way from April 2018 to recently closed (#1930) where folks have mentioned mobile peer connectivity issues. It seems some of these issues persist. I am hoping this comment is helpful and relevant, even though the code base may be different (optimized LNAPP opposed to 0.5.1-beta ). If not please disregard.