Unhandled rejection TypeError: child.send is not a function
krrssna-g-s opened this issue · 6 comments
Getting error in Jenkins job (Ubuntu box)
node[3708]: pthread_create: Resource temporarily unavailable
Unhandled rejection TypeError: child.send is not a function
at fork (/app/onejenkins/workspace/app.Build/build/node_modules/worker-farm/lib/fork.js:22:9)
at Farm.startChild (/app/onejenkins/workspace/app.Build/build/node_modules/worker-farm/lib/farm.js:106:16)
at Farm.processQueue (/app/onejenkins/workspace/app.Build/build/node_modules/worker-farm/lib/farm.js:279:10)
at Farm.addCall (/app/onejenkins/workspace/app.Build/build/node_modules/worker-farm/lib/farm.js:307:8)
at Farm. (/app/onejenkins/workspace/app.Build/build/node_modules/worker-farm/lib/farm.js:38:10)
at _class.boundWorkers (/app/onejenkins/workspace/app.Build/build/node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js:71:24)
at enqueue (/app/onejenkins/workspace/app.Build/build/node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js:96:17)
at tryCatcher (/app/onejenkins/workspace/app.Build/build/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/app/onejenkins/workspace/app.Build/build/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/app/onejenkins/workspace/app.Build/build/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/app/onejenkins/workspace/app.Build/build/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/app/onejenkins/workspace/app.Build/build/node_modules/bluebird/js/release/promise.js:689:18)
at Async._drainQueue (/app/onejenkins/workspace/app.Build/build/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/app/onejenkins/workspace/app.Build/build/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/app/onejenkins/workspace/app.Build/build/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
Same problem, when i run npm ci
on solaris. It failing with:
TypeError: child.send is not a function
at fork (/usr/node/lib/node_modules/npm/node_modules/worker-farm/lib/fork.js:23:9)
at Farm.startChild (/usr/node/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js:106:16)
at Farm.processQueue (/usr/node/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js:279:10)
at Farm.addCall (/usr/node/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js:307:8)
at Farm.<anonymous> (/usr/node/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js:38:10)
at BB.fromNode (/usr/node/lib/node_modules/npm/node_modules/libcipm/lib/extract.js:50:7)
at tryCatcher (/usr/node/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
at Function.Promise.fromNode.Promise.fromCallback (/usr/node/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:180:30)
at Object.child (/usr/node/lib/node_modules/npm/node_modules/libcipm/lib/extract.js:32:15)
at then.wasBundled (/usr/node/lib/node_modules/npm/node_modules/libcipm/index.js:205:41)
at tryCatcher (/usr/node/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/usr/node/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/usr/node/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromiseCtx (/usr/node/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:606:10)
at Async._drainQueue (/usr/node/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:138:12)
at Async._drainQueues (/usr/node/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10)
Related to https://npm.community/t/npm-ci-failed-child-send-is-not-a-function/726 and npm/npm#20067
this is pretty nasty but it looks like an upstream Node problem. child.send is not a function
means that ChildProcess
returned by child_process.fork()
doesn't have a send()
method, which it should always have.
My guess is that the pthread_create: Resource temporarily unavailable
is the key and that the child_process operation failed due to some kind of resource constraint.
If anyone else experiences this and finds this issue, feel free to drop a note in, it's a pretty interesting bug in Node—if there's a pthread_create
error then I reckon we shouldn't even get a new ChildProcess
, and if we do then it should at least have a send()
method even if that doesn't work and an 'error'
is fired soon after. Maybe we can get something fixed upstream.
^ and by "fixed" I don't mean resolving your resource problems, just getting it to behave properly in an error situation
I solaris we have virtual machines with limited threads per VM. And I think npm ci
reaches this limit. It would be great to be able to reduce the maximum number of threads, for example through environment variables.
I think that worker-farm is disabled in the latest versions of npm, i.e. https://github.com/npm/cli/blob/656bce7dd0f9753a273912e803261ed246593924/lib/install/action/extract.js#L29, maybe update your npm install (npm i npm -g
or use a newer version of Node) and try again.
Ok, thanks. npm ci
works with npm@6.9.1