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

Split packet clearing schedule from packet worker #4080

Merged

Conversation

ljoss17
Copy link
Contributor

@ljoss17 ljoss17 commented Jul 4, 2024

Closes: #4071

Description

This PR removes the packet clearing logic from the packet_cmd_worker.
The reason is to avoid blocking the worker if there is a huge amount of pending packets.

The packet_cmd_worker will not handle packet clearing anymore, instead an additional background task, clear_cmd_worker will schedule pending packets to be cleared. And the packets will be cleared by the when handle_execute_schedule is called.
A new configuration clear_limit is added in order to only clear up to a maximum of n packets every time clearing is triggered. The default value is 50.

There is an exception for Ordered channels, in which case the clearing is blocking and is done before relaying. This is because relaying without completing the packet clearing before would fail due to an incorrect packet sequence error.


PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests: integration (for Hermes) or unit/mock tests (for modules).
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).
  • Tagged one reviewer who will be the one responsible for shepherding this PR.

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.
  • Manually tested (in case integration/unit/mock tests are absent).

@ljoss17 ljoss17 requested a review from romac July 4, 2024 12:09
@ljoss17 ljoss17 marked this pull request as ready for review August 2, 2024 12:18
Copy link
Member

@romac romac left a comment

Choose a reason for hiding this comment

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

Great work! Left a couple nits

config.toml Outdated Show resolved Hide resolved
config.toml Outdated Show resolved Hide resolved
crates/relayer/src/worker/packet.rs Outdated Show resolved Hide resolved
ljoss17 and others added 3 commits August 6, 2024 09:29
Co-authored-by: Romain Ruetschi <romain@informal.systems>
Signed-off-by: Luca Joss <43531661+ljoss17@users.noreply.github.com>
@ljoss17 ljoss17 added this pull request to the merge queue Aug 6, 2024
Merged via the queue into master with commit f9b0194 Aug 6, 2024
30 checks passed
@ljoss17 ljoss17 deleted the luca_joss/split-packet-clearing-schedule-from-packet-worker branch August 6, 2024 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clearing packets apparently blocks Hermes from properly working
2 participants