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 #110

Closed benjamin-dk closed 6 years ago

benjamin-dk commented 7 years ago
2017-10-02T18:38:16.360Z - ESC[32minfoESC[39m: Admin user disconnected. 8f5c215c-8b4e-4ab0-8afc-dbaf1b41d912
2017-10-02T18:38:16.360Z - ESC[32minfoESC[39m: User logout: No valid reference to client.
2017-10-02T18:38:16.361Z - ESC[32minfoESC[39m: User logout: Chat duration (minutes):  159
2017-10-02T18:38:16.369Z - ESC[31mwarningESC[39m: Last admin user disconnected - shutting down room. Counselor id:  8f5c215c-8b4e-4ab0-8afc-dbaf1b41d912
2017-10-02T18:38:16.371Z - ESC[32minfoESC[39m: User logout: No valid reference to client.
2017-10-02T18:38:16.371Z - ESC[32minfoESC[39m: User logout: Chat duration (minutes):  159
2017-10-02T18:38:16.373Z - ESC[31mwarningESC[39m: Last admin user disconnected - shutting down room. Counselor id:  8f5c215c-8b4e-4ab0-8afc-dbaf1b41d912
stream.js:74
      throw er; // Unhandled stream error in pipe.
      ^

TypeError: Cannot read property 'group' of undefined
    at /home/<username>/domains/<username>-node.curachat.com/opeka/nodejs/lib/opeka.js:1095:11
    at Group.self.hasClient (/home/<username>/domains/<username>-node.curachat.com/opeka/nodejs/lib/groups.js:107:9)
    at Client.<anonymous> (/home/<username>/domains/<username>-node.curachat.com/opeka/nodejs/lib/opeka.js:1082:22)
    at methods.(anonymous function) (/home/<username>/domains/<username>-node.curachat.com/opeka/nodejs/lib/groups.js:184:49)
    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)
    at SockJSConnection.emit (events.js:188:7)
error: Forever detected script exited with code: 1
error: Script restart attempt #1
benjamin-dk commented 6 years ago

This error was seen after restarting the chat - the "unknown user" was a client that a chat room open before the restart in 06a15367 in branch reconnect-attempt-2.

2018-05-23T13:13:53.935Z - info: Connection ready for user with IP  87.49.147.255
newState for f0b3c9f6-4a82-43da-b78b-59d7954b5f38 is:  1
Reconnect from unknown user 48aed43f-aa67-4b51-b47b-5c3756adfe99
PING f0b3c9f6-4a82-43da-b78b-59d7954b5f38 1527081234844
PONG f0b3c9f6-4a82-43da-b78b-59d7954b5f38 1527081234844: 84
PING cc60659d-39f9-4e9a-bd8f-4ce75e89a86d 1527081236709
PONG cc60659d-39f9-4e9a-bd8f-4ce75e89a86d 1527081236709: 178
PING f0b3c9f6-4a82-43da-b78b-59d7954b5f38 1527081239854
PONG f0b3c9f6-4a82-43da-b78b-59d7954b5f38 1527081239854: 79
PING cc60659d-39f9-4e9a-bd8f-4ce75e89a86d 1527081241710
PONG cc60659d-39f9-4e9a-bd8f-4ce75e89a86d 1527081241710: 60
PING f0b3c9f6-4a82-43da-b78b-59d7954b5f38 1527081244857
PONG f0b3c9f6-4a82-43da-b78b-59d7954b5f38 1527081244857: 83
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:1162: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:1148: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