ammoio / battlejs

3 stars 4 forks source link

BattleJS Crashes the server sometimes #87

Open alexmckenley opened 10 years ago

alexmckenley commented 10 years ago

This is the line BattleJS always crashes on:

/home/ubuntu/git/battlejs/app/sockets.js:166
      if (thisGame && socket.id === thisGame.players[0].socketID) { 

winner: null } debug: websocket writing 5:::{"name":"startGame","args":[{"name":"Reverse String","functionName":"reverseString","boilerplate":"var reverseString = function (string) {\n return string;\n};"}]} debug: websocket writing 5:::{"name":"startGame","args":[{"name":"Reverse String","functionName":"reverseString","boilerplate":"var reverseString = function (string) {\n return string;\n};"}]} debug: websocket writing 5:::{"name":"receivedAvailableGames","args":[[["NZWe",0,1,"greg"],["SBYG",1,0,"butt snacks"],["HNt6",0,1,"more"],["Xyf5",2,0,"Ray"]]]} debug: websocket writing 5:::{"name":"receivedAvailableGames","args":[[["NZWe",0,1,"greg"],["SBYG",1,0,"butt snacks"],["HNt6",0,1,"more"],["Xyf5",2,0,"Ray"]]]} debug: websocket writing 5:::{"name":"receivedAvailableGames","args":[[["NZWe",0,1,"greg"],["SBYG",1,0,"butt snacks"],["HNt6",0,1,"more"],["Xyf5",2,0,"Ray"]]]} debug: websocket writing 5:::{"name":"receivedAvailableGames","args":[[["NZWe",0,1,"greg"],["SBYG",1,0,"butt snacks"],["HNt6",0,1,"more"],["Xyf5",2,0,"Ray"]]]} debug: websocket writing 5:::{"name":"receivedAvailableGames","args":[[["NZWe",0,1,"greg"],["SBYG",1,0,"butt snacks"],["HNt6",0,1,"more"],["Xyf5",2,0,"Ray"]]]}

/home/ubuntu/git/battlejs/app/sockets.js:166 if (thisGame && socket.id === thisGame.players[0].socketID) { ^ TypeError: Cannot read property 'socketID' of undefined at Socket. (/home/ubuntu/git/battlejs/app/sockets.js:166:56) at Socket.EventEmitter.emit as $emit at SocketNamespace.handlePacket (/home/ubuntu/git/battlejs/node_modules/socket.io/lib/namespace.js:335:22) at Manager.onClientMessage (/home/ubuntu/git/battlejs/node_modules/socket.io/lib/manager.js:488:38) at WebSocket.Transport.onMessage (/home/ubuntu/git/battlejs/node_modules/socket.io/lib/transport.js:387:20) at Parser. (/home/ubuntu/git/battlejs/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10) at Parser.EventEmitter.emit (events.js:95:17) at finish (/home/ubuntu/git/battlejs/node_modules/socket.io/lib/transports/websocket/hybi-16.js:288:16) at Parser.expectHandler (/home/ubuntu/git/battlejs/node_modules/socket.io/lib/transports/websocket/hybi-16.js:299:15) at Parser.add (/home/ubuntu/git/battlejs/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24) 5 Mar 01:55:15 - [nodemon] app crashed - waiting for file changes before starting...

alexmckenley commented 10 years ago

Still crashing:

debug: websocket writing 5:::{"name":"receivedAvailableGames","args":[[["ftTb",0,1,"hoop"],["UM6y",1,1,null],["LlgM",1,0,""]]]}
debug: websocket writing 5:::{"name":"receivedAvailableGames","args":[[["ftTb",0,1,"hoop"],["UM6y",1,1,null],["LlgM",1,0,""]]]}

/home/ubuntu/git/battlejs/app/sockets/in_game_logic/update.js:20
    } else if (socket.id === thisGame.players[1].socketID) {
                                                ^
TypeError: Cannot read property 'socketID' of undefined
    at Socket.<anonymous> (/home/ubuntu/git/battlejs/app/sockets/in_game_logic/update.js:20:49)
    at Socket.EventEmitter.emit [as $emit] (events.js:95:17)
    at SocketNamespace.handlePacket (/home/ubuntu/git/battlejs/node_modules/socket.io/lib/namespace.js:335:22)
    at Manager.onClientMessage (/home/ubuntu/git/battlejs/node_modules/socket.io/lib/manager.js:488:38)
    at WebSocket.Transport.onMessage (/home/ubuntu/git/battlejs/node_modules/socket.io/lib/transport.js:387:20)
    at Parser.<anonymous> (/home/ubuntu/git/battlejs/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10)
    at Parser.EventEmitter.emit (events.js:95:17)
    at finish (/home/ubuntu/git/battlejs/node_modules/socket.io/lib/transports/websocket/hybi-16.js:288:16)
    at Parser.expectHandler (/home/ubuntu/git/battlejs/node_modules/socket.io/lib/transports/websocket/hybi-16.js:299:15)
    at Parser.add (/home/ubuntu/git/battlejs/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24)