我有聊天克隆聊天服务。在压力下,我的nodejs(超过150个用户)崩溃,错误“TypeError:无法读取属性'chId'未定义”。
/home/kotka/randomi.fi/beta/varaserver2/channel.js:67
f = this.channels[e].chId;
^
TypeError: Cannot read property 'chId' of undefined
at Channel.joinChannel (/home/kotka/randomi.fi/beta/varaserver2/channel.js:67:23)
at Session.createSession (/home/kotka/randomi.fi/beta/varaserver2/session.js:21:23)
at /home/kotka/randomi.fi/beta/varaserver2/path.js:1:268
at Server.<anonymous> (/home/kotka/randomi.fi/beta/varaserver2/fu.js:43:3)
at Server.emit (events.js:70:17)
at HTTPParser.onIncoming (http.js:1610:12)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:91:29)
at Socket.ondata (http.js:1506:22)
at TCP.onread (net.js:374:27)
问题是什么以及如何解决?
答案 0 :(得分:0)
尝试使用
捕获异常process.on('uncaughtException', function(err) {
console.error(err.stack);
});
答案 1 :(得分:-1)
这仅表示this.channels[e]
undefined
且没有chId
属性。