Some determinism fixes#1460
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1460 +/- ##
==========================================
+ Coverage 53.73% 53.74% +0.01%
==========================================
Files 137 137
Lines 20578 20614 +36
Branches 5210 5223 +13
==========================================
+ Hits 11058 11080 +22
- Misses 6605 6611 +6
- Partials 2915 2923 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
sporksmith
left a comment
There was a problem hiding this comment.
Approving now since the current state is definitely an improvement, but maybe worth a re-review if you do decide to switch to trees.
|
I would like to check the performance implications of the changes in the PR before merging it. |
|
Tested this PR in a 5% Tor network suing shadow/tornettools. This PR appears to have a negligible performance impact. |
When a managed process attempts to retrieve epoll events for fds that it is waiting on, we need to return the fds to the process in an order that is deterministic across simulation runs. Here we add a mechanism to sort the watch objects so that we report the events in a deterministic order.

This primarily includes a fix for a confirmed non-deterministic behavior I found in the epoll getEvents function (in c6039d3).
I also updated a couple of other places in the code where we iterate a hash table (which is non-deterministic) - these were unconfirmed issues but I suspected they might cause problems. (Probably best if we stop using glib hash table iterators in general, and instead prefer an iterator that guarantees a total ordering; rust probably makes this easier.)
Closes #1294