Unhandled rejection Error [ERR_IPC_CHANNEL_CLOSED]: channel closed #1

Open
opened 2019-02-08 17:47:11 +00:00 by Ghost · 3 comments
END CERTIFICATE-----\n',
   subject: 'mydomain.net',
   altnames: [ 'mydomain.net', '*.dvlp.mydomain.net', '*.mydomain.net' ],
   _issuedAt: 2018-03-13T00:00:00.000Z,
   _expiresAt: 2019-06-11T23:59:59.000Z,
   issuedAt: 1520899200000,
   expiresAt: 1560297599000 }
 Unhandled rejection Error [ERR_IPC_CHANNEL_CLOSED]: channel closed
     at ChildProcess.target.send (internal/child_process.js:578:16)
     at Worker.send (internal/cluster/worker.js:54:28)
     at /opt/app/node_modules/greenlock-cluster/master.js:80:15
     at Array.forEach (<anonymous>)
     at /opt/app/node_modules/greenlock-cluster/master.js:79:25
 From previous event:
     at /opt/app/node_modules/greenlock-cluster/master.js:76:17
     at Object.approveDomains (/opt/app/cluster.js:80:6)
     at Worker.<anonymous> (/opt/app/node_modules/greenlock-cluster/master.js:41:12)
     at emitTwo (events.js:131:20)
     at Worker.emit (events.js:214:7)
     at ChildProcess.Worker.process.on (internal/cluster/worker.js:42:12)
     at emitTwo (events.js:126:13)
     at ChildProcess.emit (events.js:214:7)
     at emit (internal/child_process.js:762:12)
     at _combinedTickCallback (internal/process/next_tick.js:142:11)
     at process._tickCallback (internal/process/next_tick.js:181:9)

Node Version: v10.15.1
greenlock-cluster@2.1.0


Note: This only occurs after the process has been idle for hours.

``` END CERTIFICATE-----\n', subject: 'mydomain.net', altnames: [ 'mydomain.net', '*.dvlp.mydomain.net', '*.mydomain.net' ], _issuedAt: 2018-03-13T00:00:00.000Z, _expiresAt: 2019-06-11T23:59:59.000Z, issuedAt: 1520899200000, expiresAt: 1560297599000 } Unhandled rejection Error [ERR_IPC_CHANNEL_CLOSED]: channel closed at ChildProcess.target.send (internal/child_process.js:578:16) at Worker.send (internal/cluster/worker.js:54:28) at /opt/app/node_modules/greenlock-cluster/master.js:80:15 at Array.forEach (<anonymous>) at /opt/app/node_modules/greenlock-cluster/master.js:79:25 From previous event: at /opt/app/node_modules/greenlock-cluster/master.js:76:17 at Object.approveDomains (/opt/app/cluster.js:80:6) at Worker.<anonymous> (/opt/app/node_modules/greenlock-cluster/master.js:41:12) at emitTwo (events.js:131:20) at Worker.emit (events.js:214:7) at ChildProcess.Worker.process.on (internal/cluster/worker.js:42:12) at emitTwo (events.js:126:13) at ChildProcess.emit (events.js:214:7) at emit (internal/child_process.js:762:12) at _combinedTickCallback (internal/process/next_tick.js:142:11) at process._tickCallback (internal/process/next_tick.js:181:9) ``` Node Version: v10.15.1 greenlock-cluster@2.1.0 ---- Note: This only occurs after the process has been idle for hours.
Author

Also occurring in Node Version v8.15.0

Also occurring in Node Version v8.15.0
Author

Ok. This is a possible false alarm. Found evidence that my children are exiting unexpectedly. I'll need to cleanup the opts._workers array to keep things current.

Ok. This is a possible false alarm. Found evidence that my children are exiting unexpectedly. I'll need to cleanup the opts._workers array to keep things current.
Author

This small addition to my code solves the issue for me.

cluster.on('exit', (worker) => {
	// cleanup from LE workers array if the worker exits
	let widx = leOptions._workers.findIndex(w => w.id === worker.id);
	if (widx !== -1) leOptions._workers.splice(widx, 1);
});

And its necessary as greenlock-cluster/master.js creates an array of workers via the addWorker method (line #26). If those workers die or get killed externally for any reason then the attempt to broadcast to all of them on line #80 fails with ERR_IPC_CHANNEL_CLOSED.

FYI: as an optimization, it may be simpler to rely on the hash of active workers provided by the cluster module.
https://nodejs.org/dist/latest-v10.x/docs/api/cluster.html#cluster_cluster_workers

Otherwise, adding the code above to the documentation would be helpful to new users relying on this module.

This small addition to my code solves the issue for me. ``` cluster.on('exit', (worker) => { // cleanup from LE workers array if the worker exits let widx = leOptions._workers.findIndex(w => w.id === worker.id); if (widx !== -1) leOptions._workers.splice(widx, 1); }); ``` And its necessary as greenlock-cluster/master.js creates an array of workers via the addWorker method (line #26). If those workers die or get killed externally for any reason then the attempt to broadcast to all of them on line #80 fails with ERR_IPC_CHANNEL_CLOSED. FYI: as an optimization, it may be simpler to rely on the hash of active workers provided by the cluster module. https://nodejs.org/dist/latest-v10.x/docs/api/cluster.html#cluster_cluster_workers Otherwise, adding the code above to the documentation would be helpful to new users relying on this module.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: coolaj86/greenlock-cluster.js#1
No description provided.