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

Error: Unexpected early exit #1594

Open
mcriley821 opened this issue Sep 27, 2023 · 4 comments · May be fixed by #1604
Open

Error: Unexpected early exit #1594

mcriley821 opened this issue Sep 27, 2023 · 4 comments · May be fixed by #1604

Comments

@mcriley821
Copy link

  • Rollup Plugin Name: plugin-terser
  • Rollup Plugin Version: 0.4.3
  • Rollup Version: 3.29.2
  • Operating System (or Browser): aarch64 android
  • Node Version: 20.2.0
  • Link to reproduction (⚠️ read below):

https://stackblitz.com/edit/rollup-repro-myx9um

Expected Behavior

Build to complete successfully

Actual Behavior

[!] Error: Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:
(terser) renderChunk
    at process.handleBeforeExit (/data/data/com.termux/files/usr/lib/node_modules/rollup/dist/shared/rollup.js:26388:28)
    at Object.onceWrapper (node:events:626:26)
    at process.emit (node:events:511:28)

Additional Information

I didn't see a way to change the architecture in stackblitz, so the build runs okay. This indicates there's some architecture problem with aarch64, I'm trying to pinpoint whether it's in the plugin or rollup itself.

@easrng
Copy link

easrng commented Oct 7, 2023

I'm hitting this too :/

~/enafore $ node --version
v20.2.0
~/enafore $ uname -a
Linux localhost 5.10.194-android13-4-g290eb1d8e5b9 #1 SMP PREEMPT Wed Sep 6 02:22:22 UTC 2023 aarch64 Android
~/enafore $

terser itself runs fine

~/enafore $ echo 'a      = true' | pnpx terser
Packages: +12
++++++++++++
Progress: resolved 12, reused 12, downloaded 0, added 12, done
a=true;
~/enafore $

I'm out and about rn (which is why I'm doing dev in termux lol) but when I get home I can try to debug.

@easrng
Copy link

easrng commented Oct 8, 2023

okay looks like the issue is os.cpus() can return [], in which case WorkerPool.maxInstances defaults to 0, so a new worker will never be added and the tasks won't run.

easrng pushed a commit to easrng/rollup-plugins that referenced this issue Oct 8, 2023
easrng pushed a commit to easrng/rollup-plugins that referenced this issue Oct 8, 2023
@easrng easrng linked a pull request Oct 8, 2023 that will close this issue
9 tasks
@easrng
Copy link

easrng commented Oct 8, 2023

a workaround until the fix is merged is to set maxWorkers: cpus().length || 1 manually
unfortunately, terser checks for extra unrecognized options so you need to

Object.defineProperties(options, {
  maxWorkers: {
    value: cpus().length || 1,
    enumerable: false
  }
})

@mcriley821
Copy link
Author

Awesome. Thank you for looking into this!

shellscape pushed a commit to easrng/rollup-plugins that referenced this issue Oct 15, 2023
@stale stale bot added the x⁷ ⋅ stale label Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants