[go: nahoru, domu]

Skip to content
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

Eliminate host prioritization for packet events #2378

Open
stevenengler opened this issue Aug 25, 2022 · 0 comments
Open

Eliminate host prioritization for packet events #2378

stevenengler opened this issue Aug 25, 2022 · 0 comments
Labels
Type: Bug Error or flaw producing unexpected results

Comments

@stevenengler
Copy link
Contributor

The host's event queue is a priority queue of event objects. To have a deterministic event order across simulations, for a given instant in time, shadow will prioritize events originating from certain hosts over others. For packets arriving at a destination host at a given time, packet events will be prioritized by the source host's ID. This means that all packets incoming from host A will be processed and added to the destination host's router before any packets incoming from host B are.

// sort by event time first, then use other fields we're able to compare
let cmp = self
.time
.cmp(&other.time)
.then_with(|| self.dst_host_id.cmp(&other.dst_host_id))
.then_with(|| self.src_host_id.cmp(&other.src_host_id))
.then_with(|| self.src_host_event_id.cmp(&other.src_host_event_id));

We should try to come up with a better event priority that is more fair, or make sure that the router behaves independently of any bias from the event queue.

A simple way of having a more fair event priority is to prioritize based on hash((src_host_id, event_id)), falling back to ordering by (src_host_id, event_id) directly if there's a collision. But this means that packets originating from a host will no longer be prioritized relative to the order they were sent in. For example TCP and UDP packets arriving at the same time instant would be reordered. This creates additional work for shadow's TCP stack, and reorders UDP packets on localhost which should not happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Error or flaw producing unexpected results
Projects
None yet
Development

No branches or pull requests

1 participant