Skip to content

The build does not fail and stalls if the load hook is called concurrently more than maxParallelFileOps in watch mode #5848

@sapphi-red

Description

@sapphi-red

Rollup Version

4.34.7

Operating System (or Browser)

Stackblitz

Node Version (if applicable)

No response

Link To Reproduction

https://stackblitz.com/edit/rollup-repro-zsj9sxnx?file=package.json,rollup.config.js

Expected Behaviour

Either of

  • The build fails with an error that tells the user to set a bigger value to maxParallelFileOps
  • maxParallelFileOps to be aware of this.load called inside load hook and not to count them twice

Actual Behaviour

The build stalls and does not show any error.

Additional information

The reproduction stalls because

  1. load hook is called many times concurrently because there's many import in a single file
  2. those load hook calls this.load
  3. this this.load is queued by fileOperationQueue because the load hook that called this.load has saturated the queue

If you set maxParallelFileOps: 100 in the reproduction, the build would end successfully.

This was found in vitejs/vite#19410. It was caused by this this.load call in commonjs plugin.
https://github.com/rollup/plugins/blob/94951774773a8797ff7e1a93d0a7ebf14f009327/packages/commonjs/src/index.js#L291

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions