File tree Expand file tree Collapse file tree
modules/pm2-io-bpm/transports Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44### Bug Fixes
55
66- Fix ` pm2 serve ` returning 403 Forbidden on Windows — traversal guard used hardcoded ` / ` separator #6109
7+ - Silence cluster worker ` error ` events to prevent boot crashes
8+ - Wrap ` process.send ` before BPM injection to avoid send-on-disconnected during boot
9+ - BPM IPC transport: log instead of ` process.exit(1) ` on disconnected send
710
811
912## 7.0.1
Original file line number Diff line number Diff line change 99 * - pid
1010 */
1111
12+ var cluster = require ( 'cluster' ) ;
13+ if ( cluster . isWorker ) {
14+ cluster . worker . on ( 'error' , function ( ) { } ) ;
15+ }
16+
1217var p = require ( 'path' ) ;
1318var cst = require ( '../constants' ) ;
1419var Utility = require ( './Utility.js' ) ;
@@ -36,6 +41,13 @@ delete process.env.pm2_env;
3641( function ProcessContainer ( ) {
3742 var fs = require ( 'fs' ) ;
3843
44+ var original_send = process . send ;
45+
46+ process . send = function ( ) {
47+ if ( process . connected )
48+ original_send . apply ( this , arguments ) ;
49+ } ;
50+
3951 ProcessUtils . injectModules ( )
4052
4153 var stdFile = pm2_env . pm_log_path ;
@@ -44,13 +56,6 @@ delete process.env.pm2_env;
4456 var pidFile = pm2_env . pm_pid_path ;
4557 var script = pm2_env . pm_exec_path ;
4658
47- var original_send = process . send ;
48-
49- process . send = function ( ) {
50- if ( process . connected )
51- original_send . apply ( this , arguments ) ;
52- } ;
53-
5459 //send node version
5560 if ( process . versions && process . versions . node ) {
5661 process . send ( {
Original file line number Diff line number Diff line change 44 * can be found in the LICENSE file.
55 */
66
7+ var cluster = require ( 'cluster' ) ;
8+ if ( cluster . isWorker ) {
9+ cluster . worker . on ( 'error' , function ( ) { } ) ;
10+ }
11+
712var p = require ( 'path' ) ;
813var cst = require ( '../constants' ) ;
914var Utility = require ( './Utility.js' ) ;
@@ -31,6 +36,13 @@ delete process.env.pm2_env;
3136( function ProcessContainer ( ) {
3237 var fs = require ( 'fs' ) ;
3338
39+ var original_send = process . send ;
40+
41+ process . send = function ( ) {
42+ if ( process . connected )
43+ original_send . apply ( this , arguments ) ;
44+ } ;
45+
3446 ProcessUtils . injectModules ( )
3547
3648 var stdFile = pm2_env . pm_log_path ;
@@ -39,13 +51,6 @@ delete process.env.pm2_env;
3951 var pidFile = pm2_env . pm_pid_path ;
4052 var script = pm2_env . pm_exec_path ;
4153
42- var original_send = process . send ;
43-
44- process . send = function ( ) {
45- if ( process . connected )
46- original_send . apply ( this , arguments ) ;
47- } ;
48-
4954 //send node version
5055 if ( process . versions && process . versions . node ) {
5156 process . send ( {
Original file line number Diff line number Diff line change @@ -86,18 +86,15 @@ class IPCTransport extends EventEmitter {
8686
8787 send ( channel , payload ) {
8888 if ( typeof process . send !== 'function' ) return - 1
89- if ( process . connected === false ) {
90- console . error ( 'Process disconnected from parent! (not connected)' )
91- return process . exit ( 1 )
92- }
89+ if ( process . connected === false ) return - 1
9390
91+ this . logger ( `Send on channel ${ channel } ` )
9492 try {
95- this . logger ( `Send on channel ${ channel } ` )
96- process . send ( { type : channel , data : payload } )
93+ process . send ( { type : channel , data : payload } , ( err ) => {
94+ if ( err ) this . logger ( 'async send failed: %s' , err && err . code )
95+ } )
9796 } catch ( err ) {
98- this . logger ( 'Process disconnected from parent !' )
99- this . logger ( err )
100- return process . exit ( 1 )
97+ this . logger ( 'Process disconnected from parent: %s' , err && err . message )
10198 }
10299 }
103100
You can’t perform that action at this time.
0 commit comments