Nodejs TypeError:无法读取未定义的属性'chId'

时间:2012-12-17 14:33:57

标签: node.js chat

我有聊天克隆聊天服务。在压力下,我的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)

问题是什么以及如何解决?

channel.js source

2 个答案:

答案 0 :(得分:0)

尝试使用

捕获异常
process.on('uncaughtException', function(err) {
console.error(err.stack);
});

答案 1 :(得分:-1)

这仅表示this.channels[e] undefined 且没有chId属性。