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

Worker threads crash if --expose-gc or --max-semi-space-size are passed in execArgv #9398

Closed
davidjb opened this issue Nov 23, 2023 · 0 comments · Fixed by #9399
Closed

Worker threads crash if --expose-gc or --max-semi-space-size are passed in execArgv #9398

davidjb opened this issue Nov 23, 2023 · 0 comments · Fixed by #9399

Comments

@davidjb
Copy link
Contributor

davidjb commented Nov 23, 2023

🐛 bug report

In the same vein as #8673, when trying to run Parcel in an AWS Lambda environment, the threads crash with the following error due to invalid execArgv flags being passed:

Error [ERR_WORKER_INVALID_EXEC_ARGV]: Initiated Worker with invalid execArgv flags: --expose-gc, --max-semi-space-size=17"

The environment for Node Lambda execution isn't openly published but the current implementation script for node20.x is available at https://gist.github.com/davidjb/432ea4e1c89f399ec412270539fe126f, showing the extent of Node options that might be passed, including:

  • --max-semi-space-size (breaks)
  • --max-old-space-size (ok)
  • --expose-gc (breaks)
  • --max-http-header-size (ok)

🎛 Configuration (.babelrc, package.json, cli command)

test.js:

const { createWorkerFarm } = require('@parcel/core');
createWorkerFarm();

Ensure @parcel/core is installed and then run node --expose-gc --max-semi-space-size=17 test.js to experience the worker crashes.

🤔 Expected Behavior

To run successfully without crashing

😯 Current Behavior

{
  "errorType": "Runtime.UnhandledPromiseRejection",
  "errorMessage": "Error [ERR_WORKER_INVALID_EXEC_ARGV]: Initiated Worker with invalid execArgv flags: --expose-gc, --max-semi-space-size=17",
  "reason": {
    "errorType": "Error",
    "errorMessage": "Initiated Worker with invalid execArgv flags: --expose-gc, --max-semi-space-size=17",
    "code": "ERR_WORKER_INVALID_EXEC_ARGV",
    "stack": [
      "Error [ERR_WORKER_INVALID_EXEC_ARGV]: Initiated Worker with invalid execArgv flags: --expose-gc, --max-semi-space-size=17",
      "    at new NodeError (node:internal/errors:406:5)",
      "    at new Worker (node:internal/worker:222:13)",
      "    at ThreadsWorker.start (/var/task/node_modules/@parcel/workers/lib/threads/ThreadsWorker.js:38:19)",
      "    at Worker.fork (/var/task/node_modules/@parcel/workers/lib/Worker.js:87:23)",
      "    at WorkerFarm.startChild (/var/task/node_modules/@parcel/workers/lib/WorkerFarm.js:229:12)",
      "    at WorkerFarm.startMaxWorkers (/var/task/node_modules/@parcel/workers/lib/WorkerFarm.js:389:14)",
      "    at new WorkerFarm (/var/task/node_modules/@parcel/workers/lib/WorkerFarm.js:136:10)",
      "    at createWorkerFarm (/var/task/node_modules/@parcel/core/lib/Parcel.js:515:10)",
      "    at file:///var/task/app.mjs:20:20",
      "    at ModuleJob.run (node:internal/modules/esm/module_job:217:25)"
    ]
  },
  "promise": {},
  "stack": [
    "Runtime.UnhandledPromiseRejection: Error [ERR_WORKER_INVALID_EXEC_ARGV]: Initiated Worker with invalid execArgv flags: --expose-gc, --max-semi-space-size=17",
    "    at process.<anonymous> (file:///var/runtime/index.mjs:1276:17)",
    "    at process.emit (node:events:514:28)",
    "    at emit (node:internal/process/promises:150:20)",
    "    at processPromiseRejections (node:internal/process/promises:284:27)",
    "    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"
  ]
}

💁 Possible Solution

So given the solution to #8673, perhaps filter the two breaking execArgv flags again.

I've opened PR #9399 with just that.

🔦 Context

Run Parcel in a Node AWS Lambda environment (node20.x)

💻 Code Sample

See Configuration section above.

🌍 Your Environment

Software Version(s)
Parcel 2.10.3
Node v20.9.0
npm/Yarn 10.1.0
Operating System AL2023
davidjb added a commit to davidjb/parcel that referenced this issue Nov 23, 2023
@davidjb davidjb changed the title Worker threads crash on AWS Lambda when unexpected execArgv are passed Worker threads crash if --expose-gc or --max-semi-space-size are passed in execArgv Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant