Skip to content

fix(turbopack): OOM fast path for WASM + bump tokio-fs-ext 0.7.8#122

Merged
xusd320 merged 1 commit intoutoofrom
fix/wasm-oom-and-deps
Mar 16, 2026
Merged

fix(turbopack): OOM fast path for WASM + bump tokio-fs-ext 0.7.8#122
xusd320 merged 1 commit intoutoofrom
fix/wasm-oom-and-deps

Conversation

@xusd320
Copy link
Copy Markdown

@xusd320 xusd320 commented Mar 16, 2026

  • Add no-restore fast path in prepare_tasks_with_callback to skip Vec allocation in WASM/NoopKvDb
  • Bump tokio-fs-ext to 0.7.8 in turbo-tasks-fs (stale dir handle retry fix)

- Add no-restore fast path in prepare_tasks_with_callback to avoid
  huge Vec allocation when using NoopKvDb (WASM environments)
- Bump tokio-fs-ext to 0.7.8 in turbo-tasks-fs (stale dir handle fix)
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a targeted performance improvement for Turbopack's backend operations by optimizing task preparation in environments without backing storage, such as WASM. Concurrently, it updates a core file system utility dependency to resolve a known issue with stale directory handles, enhancing overall stability. These changes collectively aim to improve efficiency and reliability within the Turbopack ecosystem.

Highlights

  • Performance Optimization: Implemented a no-restore fast path in prepare_tasks_with_callback to avoid unnecessary Vec allocations, specifically benefiting WASM and NoopKvDb environments.
  • Dependency Update: Bumped the tokio-fs-ext crate to version 0.7.8 in turbo-tasks-fs to incorporate a fix for stale directory handles.
  • Dependency Version Alignment: Adjusted versions of windows-sys and socket2 in Cargo.lock to align with other dependency updates.
Changelog
  • Cargo.lock
    • Downgraded windows-sys from 0.59.0 to 0.48.0.
    • Downgraded socket2 from 0.6.1 to 0.5.10.
    • Updated tokio-fs-ext from 0.7.7 to 0.7.8.
  • turbopack/crates/turbo-tasks-backend/src/backend/operation/mod.rs
    • Added a fast path to prepare_tasks_with_callback to prevent Vec allocation in WASM/NoopKvDb environments.
  • turbopack/crates/turbo-tasks-fs/Cargo.toml
    • Bumped tokio-fs-ext dependency to version 0.7.8.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a fast path in prepare_tasks_with_callback to skip a vector allocation in WASM environments, aiming to prevent out-of-memory issues. It also bumps the tokio-fs-ext dependency to version 0.7.8. My review includes a suggestion to simplify a conditional statement in the new fast path for improved readability.

Comment on lines +244 to +250
if id.is_transient() {
if call_prepared_task_callback_for_transient_tasks {
prepared_task_callback(self, id, category, task);
}
} else {
prepared_task_callback(self, id, category, task);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The conditional logic for calling prepared_task_callback can be simplified. The current nested if and else block can be expressed as a single if statement with a compound condition. This improves readability and reduces code nesting.

if !id.is_transient() || call_prepared_task_callback_for_transient_tasks {
    prepared_task_callback(self, id, category, task);
}

@xusd320 xusd320 merged commit 159a15b into utoo Mar 16, 2026
11 of 26 checks passed
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