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

fix(optimized-deps-build): avoid deadlock when loading register id and optimized id #13127

Closed
wants to merge 1 commit into from

Conversation

sun0day
Copy link
Member

@sun0day sun0day commented May 9, 2023

Description

fix #13018

Calling load(id) hook on registerId and optimizedId are currently async, this might lead to a deadlock.

The load task queue would be like [loadRegisterId1, loadOptimizedId, loadRegisterId2] according to

https://github.com/rollup/rollup/blob/742317579d7ca861047fa8320631c7e061f98c02/src/ModuleLoader.ts#L261-L263

https://github.com/rollup/rollup/blob/742317579d7ca861047fa8320631c7e061f98c02/src/utils/Queue.ts#L17-L40

loadOptimizedId should wait until all the loadRegisterId tasks finish, but it's called before loadRegisterId2, thus loadOptimizedId would never be resolved.

This PR make sure optimizedId is loaded after all the loadRegisterId finish.

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@stackblitz
Copy link

stackblitz bot commented May 9, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@sun0day sun0day changed the title fix(vite:optimized-deps-build): avoid deadlock when loading register id and optimized id fix(optimized-deps-build): avoid deadlock when loading register id and optimized id May 9, 2023
@patak-dev
Copy link
Member

Let's wait to see how rollup/rollup#4985 evolves. Given that the feature is experimental, users may better bump rollupOptions.maxParallelFileOps for the moment. If we would like to graduate this feature from experimental, I think we'll need something like the delayLoading modifier that is being proposed there.

@sapphi-red
Copy link
Member

Closing as the build-time dep-optimization is now removed (#15184).

@sapphi-red sapphi-red closed this Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimizing dependencies in build mode fails with too many pending modules
4 participants