Open Deputation opened 1 year ago
@Deputation - I believe the correct behavior would be to iterate through the table entries once and return None.
I'd suggest taking a look at libbpf-rs instead of this crate though.
I'd happily accept a PR that fixes this and publish a new version of the crate. But I've migrated to libbpf-rs so there's not much active focus on these crates right now.
I encountered an issue related to the iteration of BPF table entries, which resulted in an infinite loop. The loop continually processes the table going over it and restarting from the start without ever really stopping.
The issue arises during the iteration of BPF entries in a table using
table.iter()
. In the loop, the same entries seem to be processed repeatedly, leading to an infinite loop and prohibiting the iteration from reaching its expected end.Faulty code snippet:
I anticipated that the iterator would process each entry in the BPF table exactly once, eventually reaching the end of the table and exiting the loop. If this is not the expected behavior (as the examples of the library would imply) this issue can simply be closed.
Workaround:
I would greatly appreciate clarification on whether the described behavior is expected or if it might be a potential bug. Specifically, is the iterator designed to restart from the beginning of the entries after each loop, or should it progress through each entry once and subsequently exit the loop?