Skip to content

Conversation

@aduh95
Copy link
Contributor

@aduh95 aduh95 commented Jan 29, 2021

This PR fixes a bug that currently happen on nightly versions of Node.js due to a recent in the Node.js codebase:

1) WorkerHandler
       create a worker handler with custom script:
     Uncaught TypeError [ERR_INVALID_ARG_TYPE]: The "options" argument must be of type object. Received an instance of Array
      at ChildProcess.target.send (node:internal/child_process:716:7)
      at Array.forEach (<anonymous>)
      at dispatchQueuedRequests (src/WorkerHandler.js:262:21)
      at ChildProcess.<anonymous> (src/WorkerHandler.js:221:7)
      at ChildProcess.emit (node:events:378:20)
      at emit (node:internal/child_process:920:12)
      at processTicksAndRejections (node:internal/process/task_queues:82:21)

  2) WorkerHandler
       should handle the asynchronous initialization of a worker:
     Uncaught TypeError [ERR_INVALID_ARG_TYPE]: The "options" argument must be of type object. Received an instance of Array
      at ChildProcess.target.send (node:internal/child_process:716:7)
      at Array.forEach (<anonymous>)
      at dispatchQueuedRequests (src/WorkerHandler.js:262:21)
      at ChildProcess.<anonymous> (src/WorkerHandler.js:221:7)
      at ChildProcess.emit (node:events:378:20)
      at emit (node:internal/child_process:920:12)
      at processTicksAndRejections (node:internal/process/task_queues:82:21)

  3) Main Thread Detection
       should detect isMainThread in child_process:
     Uncaught TypeError [ERR_INVALID_ARG_TYPE]: The "options" argument must be of type object. Received an instance of Array
      at ChildProcess.target.send (node:internal/child_process:716:7)
      at Array.forEach (<anonymous>)
      at dispatchQueuedRequests (src/WorkerHandler.js:262:21)
      at ChildProcess.<anonymous> (src/WorkerHandler.js:221:7)
      at ChildProcess.emit (node:events:378:20)
      at emit (node:internal/child_process:920:12)
      at processTicksAndRejections (node:internal/process/task_queues:82:21)

Refs: https://github.com/nodejs/node/pull/37028/files#r566771229

@josdejong
Copy link
Owner

Thanks for this fix Antoine!

@josdejong josdejong merged commit e2ecc00 into josdejong:master Jan 31, 2021
@josdejong
Copy link
Owner

Your fix is published now in v6.1.0. Thanks again!

mansona pushed a commit to mansona/workerpool that referenced this pull request Jun 14, 2021
mansona pushed a commit to mansona/workerpool that referenced this pull request Jun 16, 2021
@mansona mansona mentioned this pull request Jun 16, 2021
josdejong pushed a commit that referenced this pull request Jun 17, 2021
* move to github actions (#306)

# Conflicts:
#	.travis.yml

* add node 12 14 and 16 to test matrix

* Fix ERR_INVALID_ARG_TYPE on Node.js nightly (#230)

# Conflicts:
#	src/WorkerHandler.js

Co-authored-by: Antoine du Hamel <[email protected]>
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 this pull request may close these issues.

2 participants