cfdp / opeka

Counseling chat service, built for providing anonymous help to young people at risk
https://curachat.com
GNU General Public License v3.0
10 stars 6 forks source link

TypeError: Cannot read property 'group' of undefined #126

Closed benjamin-dk closed 6 years ago

benjamin-dk commented 6 years ago

After restarting the chat process with an open room and connected clients, the chat crashed with this message (probably relates to the reconnect feature introduced here 98003f218) :

newState for 2d256db2-c8df-49b2-94a0-c919e8f8d32e is:  0
Client disconnected: onConnectionClosed 60401f4c-81f2-46eb-bc7e-8ccda11e960f
newState for 60401f4c-81f2-46eb-bc7e-8ccda11e960f is:  2
Client disconnected: onConnectionClosed 2d256db2-c8df-49b2-94a0-c919e8f8d32e
newState for 2d256db2-c8df-49b2-94a0-c919e8f8d32e is:  2
Client disconnected: sinceTimeout > disconnectLimit for 2d256db2-c8df-49b2-94a0-c919e8f8d32e
newState for 2d256db2-c8df-49b2-94a0-c919e8f8d32e is:  3
2018-03-20T08:00:32.074Z - info: Regular user disconnected. 2d256db2-c8df-49b2-94a0-c919e8f8d32e undefined
stream.js:74
      throw er; // Unhandled stream error in pipe.
      ^

TypeError: Cannot read property 'group' of undefined
    at /home/d2/domains/d2-node.curachat.com/opeka/nodejs/lib/opeka.js:1139:11
    at Group.self.hasClient (/home/d2/domains/d2-node.curachat.com/opeka/nodejs/lib/groups.js:107:9)
    at Client.<anonymous> (/home/d2/domains/d2-node.curachat.com/opeka/nodejs/lib/opeka.js:1125:22)
    at methods.(anonymous function) (/home/d2/domains/d2-node.curachat.com/opeka/nodejs/lib/groups.js:186:24)
    at Proto.apply (/home/ubuntu/.nvm/versions/node/v6.6.0/lib/node_modules/dnode/node_modules/dnode-protocol/index.js:123:13)
    at Proto.handle (/home/ubuntu/.nvm/versions/node/v6.6.0/lib/node_modules/dnode/node_modules/dnode-protocol/index.js:99:19)
    at D.dnode.handle (/home/ubuntu/.nvm/versions/node/v6.6.0/lib/node_modules/dnode/lib/dnode.js:140:21)
    at D.dnode.write (/home/ubuntu/.nvm/versions/node/v6.6.0/lib/node_modules/dnode/lib/dnode.js:128:22)
    at SockJSConnection.ondata (stream.js:31:26)
    at emitOne (events.js:96:13)
error: Forever detected script exited with code: 1
error: Script restart attempt #1
benjamin-dk commented 6 years ago

Duplicate of #110