-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Panic: preselected index must be valid in peer_set #1183
Comments
@hdevalence I think you might understand the invariants in |
@hdevalence do you think this ticket is fixed now? |
No, the error message indicates that there's an invariant being violated inside the peer set's selection logic. I gave it a cursory look when this ticket was filed and didn't see anything obvious, but I haven't seen the error recently, so I think we should deprioritize fixing it until later unless it comes up again. |
removing from Alpha release milestone based on the above, we can review this if it happens again |
I've just seen this error on the main branch again |
The panic happened on a Testnet sync, but there's nothing stopping it from happening on Mainnet. (The sync and network code doesn't distinguish between Mainnet and Testnet.) I suspect that we haven't seen this error recently because it's been hidden by other errors that we've just fixed.
|
Closes #1183. The peer set maintains a preselected ready service that it can use to perform power-of-two-choices (p2c) routing of requests. Ready services are stored by key (socket address) in an `IndexMap`, and the preselected service is represented by an `Option<usize>` indexing that map. This means that whenever the set of ready services changes (e.g., a service is removed from the peer set, or a service is taken to be used to process a request), the preselected index is invalidated. The original P2C-only implementation maintained this invariant but did not document it. The change to inventory-based routing introduced a bug by failing to maintain this invariant and appropriately invalidate the preselected index. However, this was only noticeable approximately 1/N of the time on the next request after an inventory-directed request, so the bug occurred infrequently. Luckily, the use of `.expect` caused the bug to be an immediate panic, making it possible to identify by inspecting all uses of the ready service map.
Closes #1183. The peer set maintains a preselected ready service that it can use to perform power-of-two-choices (p2c) routing of requests. Ready services are stored by key (socket address) in an `IndexMap`, and the preselected service is represented by an `Option<usize>` indexing that map. This means that whenever the set of ready services changes (e.g., a service is removed from the peer set, or a service is taken to be used to process a request), the preselected index is invalidated. The original P2C-only implementation maintained this invariant but did not document it. The change to inventory-based routing introduced a bug by failing to maintain this invariant and appropriately invalidate the preselected index. However, this was only noticeable approximately 1/N of the time on the next request after an inventory-directed request, so the bug occurred infrequently. Luckily, the use of `.expect` caused the bug to be an immediate panic, making it possible to identify by inspecting all uses of the ready service map.
Version
zebrad main branch, 19 October 2020.
Platform
Linux ... 5.4.68 #1-NixOS SMP Sat Sep 26 16:03:16 UTC 2020 x86_64 GNU/Linux
Description
While syncing testnet blocks,
zebrad
panicked with a "preselected index must be valid" error inpeer_set::set
, inside the spanzebrad::components::sync::obtain_tips
.I tried this:
Syncing testnet from genesis.
I expected to see this happen:
A successful sync.
Instead, this happened:
A tip exhaustion cycle, followed by a
zebra-network
panic.Error
Metadata
SpanTrace
The text was updated successfully, but these errors were encountered: