1

我有 Omegle 克隆聊天服务。在压力下,我的 nodejs(超过 150 个用户)崩溃并出现错误 "TypeError: Cannot read property 'chId' of undefined" 。

/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 源码

4

2 回答 2

0

尝试捕获异常

process.on('uncaughtException', function(err) {
console.error(err.stack);
});
于 2013-03-26T21:44:05.207 回答
-1

This just means that this.channels[e] is undefined and does not have a chId attribute.

于 2012-12-17T15:03:01.903 回答