Skip to content

[Bug]: LimitChunkCount plugin results in "user-provided comparison function does not correctly implement a total order" #8337

@cmdcolin

Description

@cmdcolin

System Info

  System:
    OS: Linux 6.11 Ubuntu 24.10 24.10 (Oracular Oriole)
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 18.66 GB / 30.60 GB
    Container: Yes
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.8.0 - /run/user/1001/fnm_multishells/44973_1730729366596/bin/node
    Yarn: 1.22.22 - /run/user/1001/fnm_multishells/44973_1730729366596/bin/yarn
    npm: 10.8.2 - /run/user/1001/fnm_multishells/44973_1730729366596/bin/npm
  Browsers:
    Chrome: 130.0.6723.69
    Chromium: 130.0.6723.69
  npmPackages:
    @rspack/cli: next => 1.1.0-beta.0
    @rspack/core: next => 1.1.0-beta.0

Details

I found that if I delete the LimitChunkCount plugin from the build then it it works, but including it in our build results in the error

yarn run v1.22.22
$ npm-run-all build:webpack:*
$ cross-env NODE_ENV=development rspack build
Panic occurred at runtime. Please file an issue on GitHub with the backtrace below: https://github.com/web-infra-dev/rspack/issues
Message:  user-provided comparison function does not correctly implement a total order
Location: core/src/slice/sort/shared/smallsort.rs:860

Backtrace omitted.

Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "build:webpack:dev" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Reproduce link

https://github.com/cmdcolin/rspack-error-repro

Reproduce Steps

  1. clone repo
  2. run "yarn"
  3. run "yarn build"

build outputs

Panic occurred at runtime. Please file an issue on GitHub with the backtrace below: https://github.com/web-infra-dev/rspack/issues
Message:  user-provided comparison function does not correctly implement a total order
Location: core/src/slice/sort/shared/smallsort.rs:860

the code fails particularly when LimitChunkCount plugin is on and it uses our library (which is admittedly quite large, i don't know quite what it is inside our library that would trigger this)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions