Skip to content

Conversation

@ziggie1984
Copy link
Collaborator

@ziggie1984 ziggie1984 commented Nov 27, 2025

backports #10383

@gemini-code-assist
Copy link

Summary of Changes

Hello @ziggie1984, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the robustness of the LND Mission Control Manager by implementing a mechanism to gracefully handle and recover from corrupted data within its persistent store. Previously, deserialization errors could prevent the manager from starting; now, such problematic entries are identified, logged, and automatically removed, ensuring continuous operation and improving overall system stability.

Highlights

  • Robust Mission Control Startup: The Mission Control Manager can now start up successfully even if it encounters deserialization errors within its stored payment results, preventing critical startup failures.
  • Automatic Data Cleanup: Corrupted entries that fail to deserialize are now automatically skipped, logged, deleted from the database, and removed from in-memory tracking structures.
  • Release Notes Update: A new entry has been added to the LND 20.1 release notes, documenting this fix for startup issues related to mission control store deserialization.
  • Enhanced Test Coverage: A new test case, TestMissionControlStoreDeletesCorruptedEntries, has been introduced to thoroughly validate the correct handling and removal of corrupted entries from the mission control store.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@ziggie1984 ziggie1984 self-assigned this Nov 27, 2025
@ziggie1984 ziggie1984 added the back port candidate pr which should be back ported to last major release label Nov 27, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves the robustness of the mission control manager during startup by handling deserialization errors gracefully. Instead of failing, corrupted entries are now skipped and deleted from the store, preventing startup failures. The changes in routing/missioncontrol_store.go are well-implemented and include a comprehensive test case. I've added a couple of comments: one for a minor typo in the release notes and another suggesting a performance improvement in fetchAll.

Comment on lines +27 to +36
* [Fix a startup issue in LND when ecounntering a
deserialization issue](https://github.com/lightningnetwork/lnd/pull/10383)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There is a typo in the word 'ecounntering'. It should be 'encountering'.

Suggested change
* [Fix a startup issue in LND when ecounntering a
deserialization issue](https://github.com/lightningnetwork/lnd/pull/10383)
* [Fix a startup issue in LND when encountering a
deserialization issue](https://github.com/lightningnetwork/lnd/pull/10383)

Comment on lines +194 to +203
for e := b.keys.Front(); e != nil; e = e.Next() {
keyVal, ok := e.Value.(string)
if !ok {
continue
}
if keyVal == keyStr {
b.keys.Remove(e)
break
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This loop to remove a key from b.keys has a time complexity of O(N) for each corrupted key, where N is the total number of keys. This results in a total complexity of O(C*N) for C corrupted keys.

While corrupted keys are expected to be rare, this could be made more efficient. Consider changing b.keysMap to store *list.Element pointers instead of an empty struct{}. This would allow finding and removing elements from b.keys in O(1) time, reducing the complexity of this cleanup operation to O(C).

This would require changes in newMissionControlStore and other places where keys and keysMap are modified, but would improve performance if a large number of corrupted entries need to be cleaned up.

We now allow the mission control manager to skip over deserializable
errors. We cannot repair this these results but we just skip over
it so we can startup properly.

When fetchAll() encounters entries that fail to deserialize, in
addition to skipping them, now also:

- Delete the corrupted entries from the database
- Remove them from the in-memory keysMap and keys tracking structures

This prevents corrupted entries from:
- Being counted toward maxRecords, which would cause valid entries
  to be pruned prematurely
- Persisting in the database indefinitely
- Causing inaccurate entry counts in startup logs
@ziggie1984 ziggie1984 force-pushed the backport/fix-mission-control-startup branch from 46299f4 to bec8327 Compare November 27, 2025 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

back port candidate pr which should be back ported to last major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant