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

feat(console): add large future lint #587

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

hds
Copy link
Collaborator

@hds hds commented Oct 1, 2024

In Tokio, the futures for tasks are stored on the stack unless they are
explicitly boxed. Having very large futures can be problematic as it can
cause a stack overflow.

This change makes use of new instrumentation in Tokio
(tokio-rs/tokio#6881) which includes the size of the future which drives
a task. The size isn't given its own column (we're running out of
horizontal space) and appears in the additional fields column.

A new lint has been added for large futures. By default it will show a
warning when a task's future is greater than or equal to 2048 bytes.
This value was chosen as it is the threshold at which Tokio will box a
future in debug mode. The lint has been added to the list of default
lints.

In Tokio, the futures for tasks are stored on the stack unless they are
explicitly boxed. Having very large futures can be problematic as it can
cause a stack overflow.

This change makes use of new instrumentation in Tokio
(tokio-rs/tokio#6881) which includes the size of the future which drives
a task. The size isn't given its own column (we're running out of
horizontal space) and appears in the additional fields column.

A new lint has been added for large futures. By default it will show a
warning when a task's future is greater than or equal to 2048 bytes.
This value was chosen as it is the threshold at which Tokio will box a
future in debug mode. The lint has been added to the list of default
lints.
@hds
Copy link
Collaborator Author

hds commented Oct 1, 2024

I'll keep this in draft until the Tokio PR is merged, as this feature is useless without it.

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.

1 participant