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

pallet-message-queue: Fix max message size calculation #6205

Merged
merged 4 commits into from
Oct 24, 2024

Conversation

bkchr
Copy link
Member

@bkchr bkchr commented Oct 23, 2024

The max size of a message should not depend on the weight left in a given execution context. Instead the max message size depends on the service weights configured for the pallet. A message that may does not fit into on_idle is not automatically overweight, because it may can be executed successfully in on_initialize or in another block in on_idle when there is more weight left.

The max size of a message should not depend on the weight left in a given execution context.
Instead the max message size depends on the service weights configured for the pallet. A message
that may does not fit into `on_idle` is not automatically overweight, because it may can be
executed successfully in `on_initialize` or in another block in `on_idle` when there is more
weight left.
@bkchr bkchr added the T2-pallets This PR/Issue is related to a particular pallet. label Oct 23, 2024
@bkchr bkchr requested a review from a team as a code owner October 23, 2024 20:51
Copy link
Member

@ggwpez ggwpez left a comment

Choose a reason for hiding this comment

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

I feel like this idle processing has caused more issues than advantages so far.

The hotfix looks correct, but the assumption that it will retry in the next context is not that great, since it could also retry in the same context and then keep looping around a bit...

@bkchr
Copy link
Member Author

bkchr commented Oct 23, 2024

The hotfix looks correct, but the assumption that it will retry in the next context is not that great, since it could also retry in the same context and then keep looping around a bit...

How could it retry in the same context again?

@ggwpez
Copy link
Member

ggwpez commented Oct 23, 2024

How could it retry in the same context again?

I guess eventually it should resolve if there is any on_idle weight. If the chain is constantly at 100% then dont know.

Quite a few chains seem to use it currently: https://github.com/search?q=%22IdleMaxServiceWeight+%3D%22&type=code
I will query the datalake tomorrow for OverweightEnqueued events by parachain.

@bkchr
Copy link
Member Author

bkchr commented Oct 24, 2024

I guess eventually it should resolve if there is any on_idle weight. If the chain is constantly at 100% then dont know.

The problem is OnIdle, that when you have not enough weight left. Right now the message is seen as constantly overweight, but with my fix here it is only pushed back and retried in the next block. A further optimization could be that we try other messages if they may fit.

@bkchr
Copy link
Member Author

bkchr commented Oct 24, 2024

/cmd prdoc --bump patch --audience runtime-dev

Copy link

Command "prdoc --bump patch --audience runtime-dev" has failed ❌! See logs here

@bkchr
Copy link
Member Author

bkchr commented Oct 24, 2024

/cmd prdoc --bump patch --audience runtime_dev

@bkchr bkchr enabled auto-merge October 24, 2024 22:03
@bkchr bkchr added this pull request to the merge queue Oct 24, 2024
Merged via the queue into master with commit 5d7181c Oct 24, 2024
194 of 195 checks passed
@bkchr bkchr deleted the bkchr-message-queue-stuff branch October 24, 2024 23:44
mordamax pushed a commit to paritytech-stg/polkadot-sdk that referenced this pull request Oct 25, 2024
The max size of a message should not depend on the weight left in a
given execution context. Instead the max message size depends on the
service weights configured for the pallet. A message that may does not
fit into `on_idle` is not automatically overweight, because it may can
be executed successfully in `on_initialize` or in another block in
`on_idle` when there is more weight left.

---------

Co-authored-by: GitHub Action <[email protected]>
mordamax pushed a commit to paritytech-stg/polkadot-sdk that referenced this pull request Oct 25, 2024
The max size of a message should not depend on the weight left in a
given execution context. Instead the max message size depends on the
service weights configured for the pallet. A message that may does not
fit into `on_idle` is not automatically overweight, because it may can
be executed successfully in `on_initialize` or in another block in
`on_idle` when there is more weight left.

---------

Co-authored-by: GitHub Action <[email protected]>
mordamax pushed a commit to paritytech-stg/polkadot-sdk that referenced this pull request Oct 25, 2024
The max size of a message should not depend on the weight left in a
given execution context. Instead the max message size depends on the
service weights configured for the pallet. A message that may does not
fit into `on_idle` is not automatically overweight, because it may can
be executed successfully in `on_initialize` or in another block in
`on_idle` when there is more weight left.

---------

Co-authored-by: GitHub Action <[email protected]>
@bkchr bkchr added the A4-needs-backport Pull request must be backported to all maintained releases. label Oct 25, 2024
@paritytech-cmd-bot-polkadot-sdk

Successfully created backport PR for stable2407:

github-actions bot pushed a commit that referenced this pull request Oct 25, 2024
The max size of a message should not depend on the weight left in a
given execution context. Instead the max message size depends on the
service weights configured for the pallet. A message that may does not
fit into `on_idle` is not automatically overweight, because it may can
be executed successfully in `on_initialize` or in another block in
`on_idle` when there is more weight left.

---------

Co-authored-by: GitHub Action <[email protected]>
(cherry picked from commit 5d7181c)
github-actions bot pushed a commit that referenced this pull request Oct 25, 2024
The max size of a message should not depend on the weight left in a
given execution context. Instead the max message size depends on the
service weights configured for the pallet. A message that may does not
fit into `on_idle` is not automatically overweight, because it may can
be executed successfully in `on_initialize` or in another block in
`on_idle` when there is more weight left.

---------

Co-authored-by: GitHub Action <[email protected]>
(cherry picked from commit 5d7181c)
@paritytech-cmd-bot-polkadot-sdk

Successfully created backport PR for stable2409:

@bkchr bkchr had a problem deploying to subsystem-benchmarks October 25, 2024 13:59 — with GitHub Actions Failure
ggwpez pushed a commit that referenced this pull request Oct 25, 2024
The max size of a message should not depend on the weight left in a
given execution context. Instead the max message size depends on the
service weights configured for the pallet. A message that may does not
fit into `on_idle` is not automatically overweight, because it may can
be executed successfully in `on_initialize` or in another block in
`on_idle` when there is more weight left.

---------

Co-authored-by: GitHub Action <[email protected]>
(cherry picked from commit 5d7181c)
@ggwpez ggwpez mentioned this pull request Oct 25, 2024
ggwpez pushed a commit that referenced this pull request Oct 25, 2024
The max size of a message should not depend on the weight left in a
given execution context. Instead the max message size depends on the
service weights configured for the pallet. A message that may does not
fit into `on_idle` is not automatically overweight, because it may can
be executed successfully in `on_initialize` or in another block in
`on_idle` when there is more weight left.

---------

Co-authored-by: GitHub Action <[email protected]>
(cherry picked from commit 5d7181c)
@ggwpez ggwpez mentioned this pull request Oct 25, 2024
ggwpez pushed a commit that referenced this pull request Oct 25, 2024
The max size of a message should not depend on the weight left in a
given execution context. Instead the max message size depends on the
service weights configured for the pallet. A message that may does not
fit into `on_idle` is not automatically overweight, because it may can
be executed successfully in `on_initialize` or in another block in
`on_idle` when there is more weight left.

---------

Co-authored-by: GitHub Action <[email protected]>
(cherry picked from commit 5d7181c)
mordamax pushed a commit to paritytech-stg/polkadot-sdk that referenced this pull request Oct 25, 2024
The max size of a message should not depend on the weight left in a
given execution context. Instead the max message size depends on the
service weights configured for the pallet. A message that may does not
fit into `on_idle` is not automatically overweight, because it may can
be executed successfully in `on_initialize` or in another block in
`on_idle` when there is more weight left.

---------

Co-authored-by: GitHub Action <[email protected]>
mordamax pushed a commit to paritytech-stg/polkadot-sdk that referenced this pull request Oct 25, 2024
The max size of a message should not depend on the weight left in a
given execution context. Instead the max message size depends on the
service weights configured for the pallet. A message that may does not
fit into `on_idle` is not automatically overweight, because it may can
be executed successfully in `on_initialize` or in another block in
`on_idle` when there is more weight left.

---------

Co-authored-by: GitHub Action <[email protected]>
ggwpez added a commit that referenced this pull request Oct 28, 2024
Backport #6205 into Release 1.14.

---------

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: Bastian Köcher <[email protected]>
ggwpez added a commit that referenced this pull request Oct 29, 2024
Backport #6205 into Release 1.13.

---------

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: Bastian Köcher <[email protected]>
mordamax pushed a commit to paritytech-stg/polkadot-sdk that referenced this pull request Oct 29, 2024
The max size of a message should not depend on the weight left in a
given execution context. Instead the max message size depends on the
service weights configured for the pallet. A message that may does not
fit into `on_idle` is not automatically overweight, because it may can
be executed successfully in `on_initialize` or in another block in
`on_idle` when there is more weight left.

---------

Co-authored-by: GitHub Action <[email protected]>
mordamax pushed a commit to paritytech-stg/polkadot-sdk that referenced this pull request Oct 29, 2024
The max size of a message should not depend on the weight left in a
given execution context. Instead the max message size depends on the
service weights configured for the pallet. A message that may does not
fit into `on_idle` is not automatically overweight, because it may can
be executed successfully in `on_initialize` or in another block in
`on_idle` when there is more weight left.

---------

Co-authored-by: GitHub Action <[email protected]>
bkchr added a commit that referenced this pull request Nov 5, 2024
Backport #6205 into `stable2407` from bkchr.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: Bastian Köcher <[email protected]>
Co-authored-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: command-bot <>
EgorPopelyaev added a commit that referenced this pull request Nov 12, 2024
Backport #6205 into `stable2409` from bkchr.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

Co-authored-by: Bastian Köcher <[email protected]>
Co-authored-by: Egor_P <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A4-needs-backport Pull request must be backported to all maintained releases. T2-pallets This PR/Issue is related to a particular pallet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants