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

TypeError: Cannot read property 'close' of null #1748

Closed
dwelle opened this issue Nov 4, 2015 · 6 comments
Closed

TypeError: Cannot read property 'close' of null #1748

dwelle opened this issue Nov 4, 2015 · 6 comments

Comments

@dwelle
Copy link

dwelle commented Nov 4, 2015

Happens in cluster mode upon server restart.

pm2 version 0.15.9, Node v4.2.1, Windows 7.

test-1 TypeError: Cannot read property 'close' of null
test-1     at Worker.disconnect (cluster.js:664:19)
test-1     at Worker.onmessage (cluster.js:529:16)
test-1     at process.<anonymous> (cluster.js:710:8)
test-1     at emitTwo (events.js:92:20)
test-1     at process.emit (events.js:172:7)
test-1     at handleMessage (internal/child_process.js:686:10)
test-1     at Pipe.channel.onread (internal/child_process.js:440:11)

config:

"name": "test",
"script": "./server.js",
"watch": "./",
"autorestart": false,
"exec_mode": "cluster_mode",
"instances": 2
@dwelle
Copy link
Author

dwelle commented Nov 4, 2015

Suddenly can't reproduce. Will post here if it returns.

@indreek
Copy link

indreek commented Dec 30, 2015

I have the same problem on ubuntu

config {
"apps" : [{
// Application #1
"name" : "XXXX",
"script" : "server.js",
"merge_logs" : true,
"cwd" : "/opt/api/XXXX",
"instances" : 0,
"exec_mode" : "cluster_mode",
"error_file" : "/opt/api/logs/pm2/error.log",
"out_file" : "/opt/api/logs/pm2/out.log",
"pid_file" : "/opt/api/pid/XXXX.pid"
}]
}

when i do pm2 stop all i get error

XXXX-0 (err): TypeError: Cannot read property 'close' of undefined
XXXX-0 (err): at Worker.disconnect (cluster.js:664:19)
XXXX-0 (err): at Worker.onmessage (cluster.js:529:16)
XXXX-0 (err): at process. (cluster.js:710:8)
XXXX-0 (err): at emitTwo (events.js:92:20)
XXXX-0 (err): at process.emit (events.js:172:7)
XXXX-0 (err): at handleMessage (internal/child_process.js:685:10)
XXXX-0 (err): at Pipe.channel.onread (internal/child_process.js:440:11)
XXXX-0 (err): TypeError: Cannot read property 'close' of undefined
XXXX-0 (err): at Worker.disconnect (cluster.js:664:19)
XXXX-0 (err): at Worker.onmessage (cluster.js:529:16)
XXXX-0 (err): at process. (cluster.js:710:8)
XXXX-0 (err): at emitTwo (events.js:92:20)
XXXX-0 (err): at process.emit (events.js:172:7)
XXXX-0 (err): at handleMessage (internal/child_process.js:685:10)
XXXX-0 (err): at Pipe.channel.onread (internal/child_process.js:440:11)

@dwelle
Copy link
Author

dwelle commented Jan 3, 2016

Happened to me once again when I mistakenly ran two Hapi server connections on the same port. Pm2 probably assumes them identical when restarting, and the 2nd throws when trying to close an already closed connection.

@soyuka
Copy link
Collaborator

soyuka commented Jan 6, 2016

Both stack traces are linking to this line.

Does pm2 fail after having this error or only the script? If you had a way to reproduce it'd be lovely, thanks!

@dwelle
Copy link
Author

dwelle commented Jan 7, 2016

The server is killed:

PM2 App name:app id:1 disconnected
PM2 8924 pid can not be killed { [Error: kill ESRCH] code: 'ESRCH', errno: 'ESRCH', syscall: 'kill' }
PM2 Starting execution sequence in -cluster mode- for app name:app id:1
PM2 App name:app id:1 exited with code 100
PM2 App name:app id:1 online
app-0 Server started on http://app:3000
app-1 Server started on http://app:3000

@Unitech
Copy link
Owner

Unitech commented Apr 1, 2016

closing in favor of #2061

@Unitech Unitech closed this as completed Apr 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants