Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

exception caught when starting game-server of "treasure" #103

Closed
jaykee0906 opened this Issue Feb 28, 2013 · 5 comments

Comments

Projects
None yet
4 participants

Caught exception: TypeError: Cannot read property 'id' of undefined
at Server.start (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/lib/master/master.js:43:68)
at EventEmitter.emit (events.js:96:17)
at exportEvent (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/pomelo-admin/lib/consoleService.js:280:14)
at EventEmitter.emit (events.js:96:17)
at Socket. (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/pomelo-admin/lib/masterAgent.js💯16)
at Socket.EventEmitter.emit as $emit
at SocketNamespace.handlePacket (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/socket.io/lib/namespace.js:335:22)
at Manager.onClientMessage (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/socket.io/lib/manager.js:488:38)
at WebSocket.Transport.onMessage (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/socket.io/lib/transport.js:387:20)
at Parser. (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10)

Caught exception: TypeError: Cannot read property 'id' of undefined
at Server.start (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/lib/master/master.js:43:68)
at EventEmitter.emit (events.js:96:17)
at exportEvent (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/pomelo-admin/lib/consoleService.js:280:14)
at EventEmitter.emit (events.js:96:17)
at Socket. (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/pomelo-admin/lib/masterAgent.js💯16)
at Socket.EventEmitter.emit as $emit
at SocketNamespace.handlePacket (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/socket.io/lib/namespace.js:335:22)
at Manager.onClientMessage (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/socket.io/lib/manager.js:488:38)
at WebSocket.Transport.onMessage (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/socket.io/lib/transport.js:387:20)
at Parser. (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10)

Caught exception: TypeError: Cannot read property 'id' of undefined
at Server.start (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/lib/master/master.js:43:68)
at EventEmitter.emit (events.js:96:17)
at exportEvent (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/pomelo-admin/lib/consoleService.js:280:14)
at EventEmitter.emit (events.js:96:17)
at Socket. (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/pomelo-admin/lib/masterAgent.js💯16)
at Socket.EventEmitter.emit as $emit
at SocketNamespace.handlePacket (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/socket.io/lib/namespace.js:335:22)
at Manager.onClientMessage (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/socket.io/lib/manager.js:488:38)
at WebSocket.Transport.onMessage (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/socket.io/lib/transport.js:387:20)
at Parser. (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10)

Caught exception: TypeError: Cannot read property 'id' of undefined
at Server.start (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/lib/master/master.js:43:68)
at EventEmitter.emit (events.js:96:17)
at exportEvent (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/pomelo-admin/lib/consoleService.js:280:14)
at EventEmitter.emit (events.js:96:17)
at Socket. (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/pomelo-admin/lib/masterAgent.js💯16)
at Socket.EventEmitter.emit as $emit
at SocketNamespace.handlePacket (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/socket.io/lib/namespace.js:335:22)
at Manager.onClientMessage (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/socket.io/lib/manager.js:488:38)
at WebSocket.Transport.onMessage (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/socket.io/lib/transport.js:387:20)
at Parser. (/Project/external/pomeloExample/treasuresUpstream/game-server/node_modules/pomelo/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10)

Owner

xiecc commented Mar 1, 2013

Sorry, we can not find the corresponding line of master.js contains someObject.id.
We have upgraded our online version to 0.2.5, reinstall the package and run again.

If there is still some error, report it to us.

limkyung commented Mar 4, 2013

I have same problem start game server lord of pomelo
reinstall pomelo version 0.2.5 but problem is not fixed
give me some advice

[2013-03-04 14:32:30.236] [ERROR] console - Caught exception: TypeError: Cannot read property 'id' of undefined
at Server.start (/Users/ned/WebstormProjects/lordofpomelo/game-server/node_modules/pomelo/lib/master/master.js:43:66)
at EventEmitter.emit (events.js:88:17)
at exportEvent (/Users/ned/WebstormProjects/lordofpomelo/game-server/node_modules/pomelo/node_modules/pomelo-admin/lib/consoleService.js:280:14)
at EventEmitter.emit (events.js:88:17)
at Socket. (/Users/ned/WebstormProjects/lordofpomelo/game-server/node_modules/pomelo/node_modules/pomelo-admin/lib/masterAgent.js💯16)
at Socket.EventEmitter.emit as $emit
at SocketNamespace.handlePacket (/Users/ned/WebstormProjects/lordofpomelo/game-server/node_modules/socket.io/lib/namespace.js:335:22)
at Manager.onClientMessage (/Users/ned/WebstormProjects/lordofpomelo/game-server/node_modules/socket.io/lib/manager.js:488:38)
at WebSocket.Transport.onMessage (/Users/ned/WebstormProjects/lordofpomelo/game-server/node_modules/socket.io/lib/transport.js:387:20)
at Parser. (/Users/ned/WebstormProjects/lordofpomelo/game-server/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10)

Owner

xiecc commented Mar 6, 2013

Can you post the content of master.js?
There is no 'id' property on master.js line 43, we need check the content.

limkyung commented Mar 6, 2013

i fixed nothing
it is master.json

  {
    "development":{
        "id": "master-server-1", "host": "127.0.0.1", "port": 3005
      },

    "production":
      {
        "id": "master-server-1", "host": "pomelo3.server.163.org", "port": 3005
      }

  }

and it's master.js

var starter = require('../master/starter');
var logger = require('pomelo-logger').getLogger(__filename);
var crashLogger = require('pomelo-logger').getLogger('crash-log');
var admin = require('pomelo-admin');
var AfterStart = require('../modules/afterStart');
var util = require('util');
var pathUtil = require('../util/pathUtil');

/**
 * master server
 */
var server = {};//module.exports;
var dserver;
var handler = {};

var Server = function(app) {
    this.app = app;
    this.masterInfo = app.get('master');
    this.registered = {};

    this.masterConsole = admin.createMasterConsole({
        port: this.masterInfo.port
    });
};

module.exports = Server;

Server.prototype.start = function(cb) {
    registerDefaultModules(this.app);
    loadModules(this.app, this.masterConsole);

    var self = this;
    this.masterConsole.start(function(err) {
        if(err) {
            cb(err);
            return;
        }
        starter.runServers(self.app);
        cb();
    });

    this.masterConsole.on('register', function(record) {
        logger.debug('[master] new register connection: %j, %j', record.id, record.type);
        self.registered[record.id] = record;
        if(checkRegistered(self)) {
            logger.info('[master] all servers have started and notify after start now...');
            self.masterConsole.agent.notifyAll(AfterStart.moduleId);
        }
    });

    this.masterConsole.on('disconnect', function(id, type, reason) {
        crashLogger.info(util.format('[%s],[%s],[%s],[%s]', type, id, Date.now(), reason || 'disconnect'));
    });
};

Server.prototype.stop = function(cb) {
    this.masterConsole.stop(cb);
};

var checkRegistered = function(master) {
    var servers = master.app.getServers();
    for(var sid in servers) {
        if(!master.registered[sid]) {
            return false;
        }
    }
    return true;
};

/**
 * Load admin modules
 */
var loadModules = function(app, consoleService) {
    // load app register modules 
    var modules = app.get('__modules__');

    if(!modules) {
        return;
    }

    var record, moduleId, module;
    for(var i=0, l=modules.length; i<l; i++){
        record = modules[i];
        if(typeof record.module === 'function') {
            module = record.module(record.opts);
        } else {
            module = record.module;
        }

        moduleId = record.moduleId || module.moduleId;

        if(!moduleId) {
            logger.warn('ignore an uname module.');
            continue;
        }

        consoleService.register(moduleId, module);  
    }
};

/**
 * Append the default system admin modules
 */
var registerDefaultModules = function(app) {
    app.registerAdmin(require('../modules/console'), {app: app, starter: starter});
    if(app.enabled('systemMonitor')) {
        app.registerAdmin(admin.modules.systemInfo);
        app.registerAdmin(admin.modules.nodeInfo);
        app.registerAdmin(admin.modules.monitorLog,{path: pathUtil.getLogPath(app.getBase())});
        app.registerAdmin(admin.modules.scripts, {app: app, path: pathUtil.getScriptPath(app.getBase())});
        app.registerAdmin(admin.modules.profiler, {isMaster: true});
    }
};

thanks

Owner

xiecc commented Mar 6, 2013

Your master.js is not 0.2.5 , you can compare it with our github's version.
You'd better clone a new version of LordOfPomelo from github, and reinstall npm modules again.

@fantasyni fantasyni closed this Jan 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment