Skip to content

Loading commonjs-proxy may lead to dead lock of fileOperationQueue #1462

Closed

Description

@vilicvane

I am using vite build --watch to build a website, the initial bundling works fine. But the subsequent changes lead to hanging on transforming.

  • Rollup Plugin Name: commonjs
  • Rollup Plugin Version: 24.0.1
  • Rollup Version: v3.20.0
  • Operating System (or Browser): Windows 11
  • Node Version: 19
  • Link to reproduction (⚠️ read below):

I have spent hours on this issue but failed to create a minimal reproduction. So I may need your help to construct one.

However, I traced down to a probable cause. See additional information.

Expected Behavior

Changes are built as expected.

Actual Behavior

Stuck on transforming.

Additional Information

In my case, there are multiple ?commonjs-proxy loading at the same time, which might have led to:

  1. More than maxParallelFileOps loading of ?commonjs-proxy modules happen at once.
  2. Those loading calls queued nested jobs in the fileOperationQueue but the queue is already at max concurrency.
  3. The nested jobs have to wait for jobs running in the queue to finish, but the running jobs are also waiting for the nested jobs to finish.
  4. Dead lock.

if (isWrappedId(id, PROXY_SUFFIX)) {
const actualId = unwrapId(id, PROXY_SUFFIX);
return getStaticRequireProxy(actualId, getRequireReturnsDefault(actualId), this.load);
}

https://github.com/rollup/rollup/blob/d44fba668e6d7a89725b8bcd82d6af655f7372b4/src/ModuleLoader.ts#L261-L264

source = await this.graph.fileOperationQueue.run(
  async () =>
    (await this.pluginDriver.hookFirst('load', [id])) ?? (await readFile(id, 'utf8'))
);

Activity

  1. locked and limited conversation to collaborators on Mar 22, 2023
  2. converted this issue into a discussion #1463 on Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions