lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.71k stars 2.09k forks source link

kvdb: concurrency issue tracker #5557

Open guggero opened 3 years ago

guggero commented 3 years ago

After merging https://github.com/lightningnetwork/lnd/pull/5484 we'll need to make sure that any DB code is aware of the reset/retry mechanism.

This issue is meant to keep track of all the possible problems that should be addressed to handle DB errors and retries more gracefully.

joostjager commented 3 years ago

Linking https://github.com/lightningnetwork/lnd/pull/5643#discussion_r692703535

"I had an idea that could help with that: modify the code to artificially always run the code inside each transaction twice. It is then as if everything needs a retry. Itests, bench, etc, should still work."

joostjager commented 3 years ago

The other issue that came up in #5643 is that callers of query functions with a callback such as ChannelGraph.ForEachChannel (and probably several others) should be prepared to receive duplicates if the read transaction is retried.

Linking https://github.com/lightningnetwork/lnd/pull/5484#discussion_r682943762 about retries of a read-only tx.