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: worker build #14614

Closed
wants to merge 2 commits into from
Closed

fix: worker build #14614

wants to merge 2 commits into from

Conversation

userquin
Copy link
Contributor

@userquin userquin commented Oct 13, 2023

When we have multiple workers, the config cannot be used as weak map key since the config can mutate.

Since we're not in a multi-thread environment we can use a fixed key to store the promise of the current worker build.

You can use the reproduction provided in #13367 , when building the third worker, there is a pending promise since the config changes and there is no way to delete it and then the error.

closes #13367

Description

check #13367

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.

When we have multiple workers, the config cannot be used as web map key since the config can mutate.

Since we're not in a multi-thread environment we can use a fixed key to store the promise of the current worker build.

You can use the reproduction provided in vitejs#13367 , when building the third worker, there is a pending promise since the config changes and there is no way to delete it and then the error.
const workerConfigSemaphore = new WeakMap<
ResolvedConfig,
typeof workerKey,
Copy link
Member

Choose a reason for hiding this comment

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

After this change, the semaphore would be global and could be replaced by a direct variable to the Promise<OutputChunk>. But AFAICS, this shouldn't fix the issue in general, it should make it happen more stable.

I think we need something like: #14113 for this to work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, we need another solution... closing this

@userquin userquin closed this Oct 13, 2023
@userquin userquin deleted the patch-1 branch October 13, 2023 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants